Skip to content

Commit d44fee1

Browse files
committed
Format code
2 parents 4916294 + 40e789d commit d44fee1

Some content is hidden

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

43 files changed

+1458
-1446
lines changed

.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"mocha": true,
77
"node": true
88
},
9-
"extends": "airbnb",
9+
"extends": ["airbnb", "prettier"],
1010
"rules": {
11-
"arrow-parens": ["error", "always"],
11+
"arrow-parens": ["error", "as-needed"],
1212
"max-len": 0,
1313
"comma-dangle": 0,
1414
"new-cap": 0,

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid"
6+
}

demo/client/components/DemoEditor/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,24 @@ import prismPlugin from '../../plugins/prism';
1313

1414
window.Draft = Draft;
1515

16-
const plugins = [
17-
prismPlugin,
18-
createMarkdownShortcutsPlugin()
19-
];
16+
const plugins = [prismPlugin, createMarkdownShortcutsPlugin()];
2017

2118
const contentState = ContentState.createFromText('');
2219
const initialEditorState = EditorState.createWithContent(contentState);
2320

2421
export default class DemoEditor extends Component {
25-
2622
state = {
27-
editorState: initialEditorState
23+
editorState: initialEditorState,
2824
};
2925

3026
componentDidMount = () => {
3127
const { editor } = this;
3228
if (editor) {
3329
setTimeout(editor.focus.bind(editor), 1000);
3430
}
35-
}
31+
};
3632

37-
onChange = (editorState) => {
33+
onChange = editorState => {
3834
window.editorState = editorState;
3935
window.rawContent = convertToRaw(editorState.getCurrentContent());
4036

@@ -45,7 +41,9 @@ export default class DemoEditor extends Component {
4541

4642
render() {
4743
const { editorState } = this.state;
48-
const placeholder = editorState.getCurrentContent().hasText() ? null : <div className={styles.placeholder}>Write something here...</div>;
44+
const placeholder = editorState.getCurrentContent().hasText() ? null : (
45+
<div className={styles.placeholder}>Write something here...</div>
46+
);
4947
return (
5048
<div className={styles.root}>
5149
{placeholder}
@@ -55,7 +53,9 @@ export default class DemoEditor extends Component {
5553
onChange={this.onChange}
5654
plugins={plugins}
5755
spellCheck
58-
ref={(element) => { this.editor = element; }}
56+
ref={element => {
57+
this.editor = element;
58+
}}
5959
/>
6060
</div>
6161
</div>

demo/client/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ import DemoEditor from './components/DemoEditor';
1010
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/client/plugins/prism.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const prismPlugin = {
2626
},
2727
render({ type, children }) {
2828
return <span className={`prism-token token ${type}`}>{children}</span>;
29-
}
30-
})
31-
]
29+
},
30+
}),
31+
],
3232
};
3333

3434
export default prismPlugin;

demo/index.html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = (props) => {
1+
module.exports = props => {
22
const body = props && props.body ? props.body : '';
33
const template = `
44
<!doctype html>

demo/server.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ const compiler = webpack(config);
99

1010
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

1719
app.use(require('webpack-hot-middleware')(compiler));
1820

@@ -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: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,20 @@ module.exports = {
1818
loaders: ['babel'],
1919
exclude: /node_modules/,
2020
include: path.join(__dirname, 'client'),
21-
}, {
21+
},
22+
{
2223
test: /\.js$/,
2324
loaders: ['babel'],
24-
include: [
25-
path.join(__dirname),
26-
path.join(__dirname, '..', 'src'),
27-
path.join(__dirname, 'client')
28-
],
29-
}, {
25+
include: [path.join(__dirname), path.join(__dirname, '..', 'src'), path.join(__dirname, 'client')],
26+
},
27+
{
3028
test: /\.css$/,
31-
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]!postcss-loader'),
29+
loader: ExtractTextPlugin.extract(
30+
'style-loader',
31+
'css-loader?modules&importLoaders=1&localIdentName=[local]___[hash:base64:5]!postcss-loader',
32+
),
3233
include: path.join(__dirname, 'client', 'components'),
33-
}
34+
},
3435
],
3536
},
3637
postcss: [autoprefixer({ browsers: ['> 1%'] })],

package.json

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,42 @@
77
"eslint": "node_modules/.bin/eslint .",
88
"build": "npm run clean && npm run build:js",
99
"build:demo": ".circleci/build-demo.sh",
10-
"build:js":
11-
"BABEL_DISABLE_CACHE=1 BABEL_ENV=production NODE_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='**/__test__/*' src",
12-
"clean":
13-
"node_modules/.bin/rimraf lib; node_modules/.bin/rimraf demo/public",
10+
"build:js": "BABEL_DISABLE_CACHE=1 BABEL_ENV=production NODE_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='**/__test__/*' src",
11+
"clean": "node_modules/.bin/rimraf lib; node_modules/.bin/rimraf demo/public",
1412
"deploy:demo": ".circleci/deploy-demo.sh",
1513
"prepublish": "npm run build",
1614
"start": "npm run start:dev",
1715
"start:dev": "node_modules/.bin/babel-node ./demo/server.js",
1816
"test": "npm run test:coverage",
19-
"test:coverage":
20-
"node_modules/.bin/nyc --require babel-core/register npm run test:mocha",
17+
"test:coverage": "node_modules/.bin/nyc --require babel-core/register npm run test:mocha",
2118
"test:mocha": "mocha --opts .mocha.opts $(find src -name '*-test.js')",
2219
"test:watch": "npm test | npm run watch",
2320
"watch": "npm-watch",
2421
"postinstall": "opencollective postinstall"
2522
},
2623
"watch": {
2724
"test": {
28-
"patterns": ["src/**/*.js"]
25+
"patterns": [
26+
"src/**/*.js"
27+
]
2928
}
3029
},
3130
"repository": {
3231
"type": "git",
3332
"url": "git+https://github.com/ngs/draft-js-markdown-shortcuts-plugin.git"
3433
},
35-
"keywords": ["draftjs", "editor", "plugin", "markdown"],
34+
"keywords": [
35+
"draftjs",
36+
"editor",
37+
"plugin",
38+
"markdown"
39+
],
3640
"author": "Atsushi Nagase",
3741
"license": "MIT",
3842
"bugs": {
3943
"url": "https://github.com/ngs/draft-js-markdown-shortcuts-plugin/issues"
4044
},
41-
"homepage":
42-
"https://github.com/ngs/draft-js-markdown-shortcuts-plugin#readme",
45+
"homepage": "https://github.com/ngs/draft-js-markdown-shortcuts-plugin#readme",
4346
"devDependencies": {
4447
"autoprefixer": "^6.5.3",
4548
"babel-cli": "^6.18.0",
@@ -65,6 +68,7 @@
6568
"enzyme-adapter-react-16": "^1.1.1",
6669
"eslint": "^3.11.1",
6770
"eslint-config-airbnb": "^13.0.0",
71+
"eslint-config-prettier": "^6.11.0",
6872
"eslint-plugin-import": "^2.2.0",
6973
"eslint-plugin-jsx-a11y": "2.2.3",
7074
"eslint-plugin-mocha": "^4.7.0",
@@ -81,6 +85,7 @@
8185
"npm-watch": "^0.1.6",
8286
"nyc": "^10.0.0",
8387
"postcss-loader": "^1.1.1",
88+
"prettier": "2.0.5",
8489
"prismjs": "^1.6.0",
8590
"raf": "^3.4.0",
8691
"react": "^16.2.0",
@@ -99,12 +104,13 @@
99104
"webpack-hot-middleware": "^2.13.2"
100105
},
101106
"peerDependencies": {
102-
"draft-js-plugins-editor":
103-
"^2.0.0 || ~2.0.0-rc.1 || 2.0.0-rc2 || 2.0.0-rc1 || 2.0.0-beta12",
107+
"draft-js-plugins-editor": "^2.0.0 || ~2.0.0-rc.1 || 2.0.0-rc2 || 2.0.0-rc1 || 2.0.0-beta12",
104108
"react": "^16.0.0 || ^15.0.0",
105109
"react-dom": "^16.0.0 || ^15.0.0"
106110
},
107-
"contributors": ["Atsushi Nagase <a@ngs.io>"],
111+
"contributors": [
112+
"Atsushi Nagase <a@ngs.io>"
113+
],
108114
"dependencies": {
109115
"decorate-component-with-props": "^1.1.0",
110116
"draft-js": "~0.10.5",

0 commit comments

Comments
 (0)