Skip to content

Commit 05564f0

Browse files
authored
Merge pull request #10 from segayuu/add-eslint-plugin-prettier
Add eslint-plugin-prettier (Fix #7)
2 parents 27506a2 + a2a2afd commit 05564f0

File tree

3 files changed

+103
-58
lines changed

3 files changed

+103
-58
lines changed

eslint.js

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
module.exports = {
2-
extends: ['eslint:recommended', 'plugin:node/recommended'],
2+
extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:prettier/recommended'],
33
rules: {
44
// override recomennded
55
'no-console': 'off',
66
'no-empty': ['error', { allowEmptyCatch: true }],
77
'no-unused-vars': ['error', { args: 'none' }],
8-
// Possible Errors
9-
'no-extra-parens': ['error', 'all', {
10-
conditionalAssign: false,
11-
returnAssign: false,
12-
nestedBinaryExpressions: false
13-
}],
148
// Best Practices
159
'array-callback-return': 'error',
1610
'block-scoped-var': 'error',
17-
'curly': ['error', 'multi-line'],
18-
'dot-location': ['error', 'property'],
1911
'dot-notation': 'error',
2012
/** eqeqeq Deprecated option. @see https://github.com/hexojs/eslint-config-hexo/issues/8 */
2113
'eqeqeq': ['error', 'allow-null'],
@@ -28,7 +20,6 @@ module.exports = {
2820
'no-implied-eval': 'error',
2921
'no-lone-blocks': 'error',
3022
'no-loop-func': 'error',
31-
'no-multi-spaces': 'error',
3223
'no-multi-str': 'error',
3324
'no-new': 'error',
3425
'no-new-func': 'error',
@@ -49,7 +40,6 @@ module.exports = {
4940
'no-with': 'error',
5041
'prefer-promise-reject-errors': 'error',
5142
'radix': 'error',
52-
'wrap-iife': 'error',
5343
'yoda': ['error', 'never'],
5444
// Strict Mode
5545
'strict': 'error',
@@ -62,68 +52,28 @@ module.exports = {
6252
'handle-callback-err': 'error',
6353
'no-path-concat': 'error',
6454
// Stylistic Issues
65-
'array-bracket-spacing': ['error', 'never'],
66-
'block-spacing': ['error', 'always'],
67-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
68-
'comma-dangle': ['error', 'never'],
69-
'comma-spacing': ['error', {
70-
before: false,
71-
after: true
72-
}],
73-
'comma-style': ['error', 'last'],
74-
'computed-property-spacing': ['error', 'never'],
75-
'eol-last': 'error',
76-
'func-call-spacing': 'error',
77-
'indent': ['error', 2, { SwitchCase: 1 }],
78-
'key-spacing': ['error', {
79-
beforeColon: false,
80-
afterColon: true
81-
}],
82-
'keyword-spacing': 'error',
8355
'linebreak-style': ['error', 'unix'],
84-
'lines-around-comment': ['error', { beforeBlockComment: true }],
8556
'new-cap': 'error',
8657
'new-parens': 'error',
8758
'no-array-constructor': 'error',
88-
'no-mixed-operators': 'error',
89-
'no-multiple-empty-lines': 'error',
9059
'no-nested-ternary': 'error',
9160
'no-new-object': 'error',
92-
'no-trailing-spaces': 'error',
9361
'no-unneeded-ternary': 'error',
94-
'no-whitespace-before-property': 'error',
9562
'one-var': ['error', {
9663
uninitialized: 'always',
9764
initialized: 'never'
9865
}],
99-
'operator-linebreak': ['error', 'before'],
100-
'quotes': ['error', 'single'],
101-
'semi': ['error', 'always'],
102-
'semi-spacing': ['error', {
103-
before: false,
104-
after: true
105-
}],
106-
'space-before-blocks': ['error', 'always'],
107-
'space-before-function-paren': ['error', 'never'],
108-
'space-in-parens': ['error', 'never'],
109-
'space-infix-ops': 'error',
110-
'space-unary-ops': ['error', {
111-
words: false,
112-
nonwords: false
113-
}],
11466
'spaced-comment': ['error', 'always'],
115-
'template-tag-spacing': ['error', 'never'],
116-
'unicode-bom': ['error', 'never'],
11767
// ECMAScript 6
118-
'arrow-spacing': 'error',
119-
'generator-star-spacing': ['error', 'after'],
120-
'no-confusing-arrow': ['error', { allowParens: true }],
12168
'no-duplicate-imports': 'error',
12269
'no-useless-computed-key': 'error',
12370
'no-useless-constructor': 'error',
12471
'no-useless-rename': 'error',
125-
'rest-spread-spacing': ['error', 'never'],
126-
'template-curly-spacing': ['error', 'never'],
127-
'yield-star-spacing': ['error', 'after']
72+
'prettier/prettier': ['error', {
73+
semi: true,
74+
singleQuote: true,
75+
tabWidth: 2,
76+
useTabs: false
77+
}]
12878
}
12979
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"eslint": ">=5.0.0"
1919
},
2020
"dependencies": {
21-
"eslint-plugin-node": "^7.0.0"
21+
"eslint-config-prettier": "^2.9.0",
22+
"eslint-plugin-node": "^7.0.0",
23+
"eslint-plugin-prettier": "^2.6.2"
2224
}
2325
}

yarn.lock

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
balanced-match@^1.0.0:
6+
version "1.0.0"
7+
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
8+
9+
brace-expansion@^1.1.7:
10+
version "1.1.11"
11+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
12+
dependencies:
13+
balanced-match "^1.0.0"
14+
concat-map "0.0.1"
15+
16+
17+
version "0.0.1"
18+
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
19+
20+
eslint-config-prettier@^2.9.0:
21+
version "2.9.0"
22+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3"
23+
dependencies:
24+
get-stdin "^5.0.1"
25+
26+
eslint-plugin-es@^1.3.1:
27+
version "1.3.1"
28+
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-1.3.1.tgz#5acb2565db4434803d1d46a9b4cbc94b345bd028"
29+
dependencies:
30+
eslint-utils "^1.3.0"
31+
regexpp "^2.0.0"
32+
33+
eslint-plugin-node@^7.0.0:
34+
version "7.0.1"
35+
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz#a6e054e50199b2edd85518b89b4e7b323c9f36db"
36+
dependencies:
37+
eslint-plugin-es "^1.3.1"
38+
eslint-utils "^1.3.1"
39+
ignore "^4.0.2"
40+
minimatch "^3.0.4"
41+
resolve "^1.8.1"
42+
semver "^5.5.0"
43+
44+
eslint-plugin-prettier@^2.6.2:
45+
version "2.6.2"
46+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.2.tgz#71998c60aedfa2141f7bfcbf9d1c459bf98b4fad"
47+
dependencies:
48+
fast-diff "^1.1.1"
49+
jest-docblock "^21.0.0"
50+
51+
eslint-utils@^1.3.0, eslint-utils@^1.3.1:
52+
version "1.3.1"
53+
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512"
54+
55+
fast-diff@^1.1.1:
56+
version "1.1.2"
57+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154"
58+
59+
get-stdin@^5.0.1:
60+
version "5.0.1"
61+
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"
62+
63+
ignore@^4.0.2:
64+
version "4.0.2"
65+
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.2.tgz#0a8dd228947ec78c2d7f736b1642a9f7317c1905"
66+
67+
jest-docblock@^21.0.0:
68+
version "21.2.0"
69+
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414"
70+
71+
minimatch@^3.0.4:
72+
version "3.0.4"
73+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
74+
dependencies:
75+
brace-expansion "^1.1.7"
76+
77+
path-parse@^1.0.5:
78+
version "1.0.5"
79+
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
80+
81+
regexpp@^2.0.0:
82+
version "2.0.0"
83+
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365"
84+
85+
resolve@^1.8.1:
86+
version "1.8.1"
87+
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
88+
dependencies:
89+
path-parse "^1.0.5"
90+
91+
semver@^5.5.0:
92+
version "5.5.0"
93+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"

0 commit comments

Comments
 (0)