Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 8327ce7

Browse files
committed
Run prettier over the repo
1 parent 9518794 commit 8327ce7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2027
-1657
lines changed

demo/client/components/DemoEditor/index.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
1-
import React, { Component } from 'react';
2-
import Editor from 'draft-js-plugins-editor';
1+
import React, { Component } from "react";
2+
import Editor from "draft-js-plugins-editor";
33

4-
import createMarkdownShortcutsPlugin from 'draft-js-markdown-shortcuts-plugin'; // eslint-disable-line
4+
import createMarkdownShortcutsPlugin from "draft-js-markdown-shortcuts-plugin"; // eslint-disable-line
55
import Draft, {
66
convertToRaw,
77
// convertFromRaw,
88
ContentState,
99
EditorState,
10-
} from 'draft-js';
11-
import styles from './styles.css';
12-
import Prism from 'prismjs';
13-
import 'prismjs/components/prism-java';
14-
import 'prismjs/components/prism-scala';
15-
import 'prismjs/components/prism-go';
16-
import 'prismjs/components/prism-sql';
17-
import 'prismjs/components/prism-bash';
18-
import 'prismjs/components/prism-c';
19-
import 'prismjs/components/prism-cpp';
20-
import 'prismjs/components/prism-kotlin';
21-
import 'prismjs/components/prism-perl';
22-
import 'prismjs/components/prism-ruby';
23-
import 'prismjs/components/prism-swift';
24-
import createPrismPlugin from 'draft-js-prism-plugin';
10+
} from "draft-js";
11+
import styles from "./styles.css";
12+
import Prism from "prismjs";
13+
import "prismjs/components/prism-java";
14+
import "prismjs/components/prism-scala";
15+
import "prismjs/components/prism-go";
16+
import "prismjs/components/prism-sql";
17+
import "prismjs/components/prism-bash";
18+
import "prismjs/components/prism-c";
19+
import "prismjs/components/prism-cpp";
20+
import "prismjs/components/prism-kotlin";
21+
import "prismjs/components/prism-perl";
22+
import "prismjs/components/prism-ruby";
23+
import "prismjs/components/prism-swift";
24+
import createPrismPlugin from "draft-js-prism-plugin";
2525
const prismPlugin = createPrismPlugin({
2626
prism: Prism,
2727
});
2828

2929
window.Draft = Draft;
3030

31-
const plugins = [
32-
prismPlugin,
33-
createMarkdownShortcutsPlugin()
34-
];
31+
const plugins = [prismPlugin, createMarkdownShortcutsPlugin()];
3532

36-
const contentState = ContentState.createFromText('');
33+
const contentState = ContentState.createFromText("");
3734
const initialEditorState = EditorState.createWithContent(contentState);
3835

3936
export default class DemoEditor extends Component {
40-
4137
state = {
42-
editorState: initialEditorState
38+
editorState: initialEditorState,
4339
};
4440

4541
componentDidMount = () => {
4642
const { editor } = this;
4743
if (editor) {
4844
setTimeout(editor.focus.bind(editor), 1000);
4945
}
50-
}
46+
};
5147

52-
onChange = (editorState) => {
48+
onChange = editorState => {
5349
window.editorState = editorState;
5450
window.rawContent = convertToRaw(editorState.getCurrentContent());
5551

@@ -60,7 +56,9 @@ export default class DemoEditor extends Component {
6056

6157
render() {
6258
const { editorState } = this.state;
63-
const placeholder = editorState.getCurrentContent().hasText() ? null : <div className={styles.placeholder}>Write something here...</div>;
59+
const placeholder = editorState.getCurrentContent().hasText() ? null : (
60+
<div className={styles.placeholder}>Write something here...</div>
61+
);
6462
return (
6563
<div className={styles.root}>
6664
{placeholder}
@@ -70,7 +68,9 @@ export default class DemoEditor extends Component {
7068
onChange={this.onChange}
7169
plugins={plugins}
7270
spellCheck
73-
ref={(element) => { this.editor = element; }}
71+
ref={element => {
72+
this.editor = element;
73+
}}
7474
/>
7575
</div>
7676
</div>

demo/client/index.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
import React from 'react';
2-
import { render } from 'react-dom';
3-
import Ribbon from 'react-github-fork-ribbon';
4-
import DemoEditor from './components/DemoEditor';
1+
import React from "react";
2+
import { render } from "react-dom";
3+
import Ribbon from "react-github-fork-ribbon";
4+
import DemoEditor from "./components/DemoEditor";
55

66
// Import your routes so that you can pass them to the <Router /> component
77
// eslint-disable-next-line import/no-named-as-default
88

99
// Only render in the browser
10-
if (typeof document !== 'undefined') {
10+
if (typeof document !== "undefined") {
1111
render(
1212
<div>
13-
<Ribbon href="https://github.com/ngs/draft-js-markdown-shortcuts-plugin/" target="_blank" position="right" color="black">
13+
<Ribbon
14+
href="https://github.com/ngs/draft-js-markdown-shortcuts-plugin/"
15+
target="_blank"
16+
position="right"
17+
color="black"
18+
>
1419
Fork me on GitHub
1520
</Ribbon>
1621
<DemoEditor />
1722
</div>,
18-
document.getElementById('root')
23+
document.getElementById("root")
1924
);
2025
}

demo/index.html.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module.exports = (props) => {
2-
const body = props && props.body ? props.body : '';
1+
module.exports = props => {
2+
const body = props && props.body ? props.body : "";
33
const template = `
44
<!doctype html>
55
<html lang="en">

demo/server.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
import url from 'url';
2-
import express from 'express';
3-
import webpack from 'webpack';
4-
import config from './webpack.config.dev';
5-
import html from './index.html';
1+
import url from "url";
2+
import express from "express";
3+
import webpack from "webpack";
4+
import config from "./webpack.config.dev";
5+
import html from "./index.html";
66

77
const app = express();
88
const compiler = webpack(config);
99

10-
app.use('/css', express.static('demo/publicTemplate/css'));
10+
app.use("/css", express.static("demo/publicTemplate/css"));
1111

12-
app.use(require('webpack-dev-middleware')(compiler, {
13-
noInfo: true,
14-
publicPath: config.output.publicPath,
15-
}));
12+
app.use(
13+
require("webpack-dev-middleware")(compiler, {
14+
noInfo: true,
15+
publicPath: config.output.publicPath,
16+
})
17+
);
1618

17-
app.use(require('webpack-hot-middleware')(compiler));
19+
app.use(require("webpack-hot-middleware")(compiler));
1820

1921
// Send the boilerplate HTML payload down for all get requests. Routing will be
2022
// handled entirely client side and we don't make an effort to pre-render pages
2123
// before they are served when in dev mode.
22-
app.get('*', (req, res) => {
24+
app.get("*", (req, res) => {
2325
const output = html();
2426
res.send(output);
2527
});
@@ -29,7 +31,7 @@ app.get('*', (req, res) => {
2931
// though we are only interested in the port.
3032
const { port } = url.parse(`http:${config.output.publicPath}`);
3133

32-
app.listen(port, 'localhost', (err) => {
34+
app.listen(port, "localhost", err => {
3335
if (err) return console.error(err); // eslint-disable-line no-console
3436
console.log(`Dev server listening at http://localhost:${port}`); // eslint-disable-line no-console
3537

demo/webpack.config.base.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
1-
var path = require('path'); // eslint-disable-line no-var
2-
var ExtractTextPlugin = require('extract-text-webpack-plugin'); // eslint-disable-line no-var
3-
var autoprefixer = require('autoprefixer'); // eslint-disable-line no-var
1+
var path = require("path"); // eslint-disable-line no-var
2+
var ExtractTextPlugin = require("extract-text-webpack-plugin"); // eslint-disable-line no-var
3+
var autoprefixer = require("autoprefixer"); // eslint-disable-line no-var
44

55
module.exports = {
66
resolve: {
77
alias: {
8-
'draft-js-markdown-shortcuts-plugin': path.join(__dirname, '..', 'src'),
9-
react: path.join(__dirname, '..', 'node_modules', 'react'),
8+
"draft-js-markdown-shortcuts-plugin": path.join(__dirname, "..", "src"),
9+
react: path.join(__dirname, "..", "node_modules", "react"),
1010
},
11-
extensions: ['', '.js'],
11+
extensions: ["", ".js"],
1212
},
1313
module: {
1414
loaders: [
1515
{
1616
// match all js files except example.js
1717
test: /^(?!.*example\.js$).*\.js$/,
18-
loaders: ['babel'],
18+
loaders: ["babel"],
1919
exclude: /node_modules/,
20-
include: path.join(__dirname, 'client'),
21-
}, {
20+
include: path.join(__dirname, "client"),
21+
},
22+
{
2223
test: /\.js$/,
23-
loaders: ['babel'],
24+
loaders: ["babel"],
2425
include: [
2526
path.join(__dirname),
26-
path.join(__dirname, '..', 'src'),
27-
path.join(__dirname, 'client')
27+
path.join(__dirname, "..", "src"),
28+
path.join(__dirname, "client"),
2829
],
29-
}, {
30+
},
31+
{
3032
test: /\.css$/,
31-
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]!postcss-loader'),
32-
include: path.join(__dirname, 'client', 'components'),
33-
}
33+
loader: ExtractTextPlugin.extract(
34+
"style-loader",
35+
"css-loader?modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]!postcss-loader"
36+
),
37+
include: path.join(__dirname, "client", "components"),
38+
},
3439
],
3540
},
36-
postcss: [autoprefixer({ browsers: ['> 1%'] })],
41+
postcss: [autoprefixer({ browsers: ["> 1%"] })],
3742
};

demo/webpack.config.dev.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-var */
2-
var path = require('path');
3-
var webpack = require('webpack');
4-
var webpackBaseConfig = require('./webpack.config.base');
5-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
2+
var path = require("path");
3+
var webpack = require("webpack");
4+
var webpackBaseConfig = require("./webpack.config.base");
5+
var ExtractTextPlugin = require("extract-text-webpack-plugin");
66

77
// Set up dev host and HMR host. For the dev host this is pretty self
88
// explanatory: We use a different live-reload server to serve our static JS
@@ -15,24 +15,24 @@ var DEV_HOST = `//localhost:${DEV_PORT}/`;
1515
var HMR_HOST = `${DEV_HOST}__webpack_hmr`;
1616

1717
module.exports = Object.assign(webpackBaseConfig, {
18-
devtool: 'inline-source-map',
18+
devtool: "inline-source-map",
1919

2020
entry: {
2121
app: [
2222
`webpack-hot-middleware/client?path=${HMR_HOST}`,
23-
'babel-polyfill',
24-
path.join(__dirname, 'client', 'index.js'),
23+
"babel-polyfill",
24+
path.join(__dirname, "client", "index.js"),
2525
],
2626
},
2727

2828
output: {
29-
path: path.join(__dirname, 'public'),
30-
filename: '[name].js',
29+
path: path.join(__dirname, "public"),
30+
filename: "[name].js",
3131
publicPath: DEV_HOST,
3232
},
3333

3434
plugins: [
35-
new ExtractTextPlugin('css/bundle.css', { disable: true }),
35+
new ExtractTextPlugin("css/bundle.css", { disable: true }),
3636
new webpack.HotModuleReplacementPlugin(),
3737
new webpack.NoErrorsPlugin(),
3838
],

demo/webpack.config.prod.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
/* eslint-disable no-var */
2-
var path = require('path');
3-
var webpack = require('webpack');
4-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
5-
var StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
6-
var webpackBaseConfig = require('./webpack.config.base');
2+
var path = require("path");
3+
var webpack = require("webpack");
4+
var ExtractTextPlugin = require("extract-text-webpack-plugin");
5+
var StaticSiteGeneratorPlugin = require("static-site-generator-webpack-plugin");
6+
var webpackBaseConfig = require("./webpack.config.base");
77

88
module.exports = Object.assign(webpackBaseConfig, {
9-
devtool: 'source-map',
9+
devtool: "source-map",
1010

1111
entry: {
12-
app: [path.join(__dirname, 'client', 'index.js')],
13-
main: [path.join(__dirname, 'index.html.js')],
12+
app: [path.join(__dirname, "client", "index.js")],
13+
main: [path.join(__dirname, "index.html.js")],
1414
},
1515

1616
output: {
17-
path: path.join(__dirname, 'public'),
18-
filename: '[name].js',
19-
libraryTarget: 'umd',
20-
publicPath: '/',
17+
path: path.join(__dirname, "public"),
18+
filename: "[name].js",
19+
libraryTarget: "umd",
20+
publicPath: "/",
2121
},
2222

2323
plugins: [
24-
new ExtractTextPlugin('[name].css', { allChunks: true }),
24+
new ExtractTextPlugin("[name].css", { allChunks: true }),
2525
new webpack.optimize.OccurenceOrderPlugin(),
2626
new webpack.DefinePlugin({
27-
'process.env': {
28-
NODE_ENV: JSON.stringify('production'),
27+
"process.env": {
28+
NODE_ENV: JSON.stringify("production"),
2929
},
3030
}),
3131
new webpack.optimize.UglifyJsPlugin({
3232
screw_ie8: true,
3333
compressor: { warnings: false },
3434
}),
35-
new StaticSiteGeneratorPlugin('main', ['/'], {}),
35+
new StaticSiteGeneratorPlugin("main", ["/"], {}),
3636
],
3737
});

0 commit comments

Comments
 (0)