Skip to content

Commit d630392

Browse files
Smarter eslint rules
1 parent 1b954fc commit d630392

1 file changed

Lines changed: 78 additions & 59 deletions

File tree

.eslintrc.js

Lines changed: 78 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,76 +13,31 @@ module.exports = {
1313
browser: true
1414
},
1515
rules: {
16-
"promise/always-return": "error",
17-
"promise/no-return-wrap": "error",
18-
"promise/param-names": "error",
19-
"promise/catch-or-return": "error",
20-
"promise/no-native": "off", // We have babel
21-
"promise/no-nesting": "error",
22-
"promise/no-promise-in-callback": "error",
23-
"promise/no-callback-in-promise": "error",
24-
"promise/avoid-new": "error",
25-
"promise/prefer-await-to-then": "off", // Not convinced of await/async
26-
"promise/prefer-await-to-callbacks": "off", // Not convinced of await/async
27-
"accessor-pairs": "error",
28-
"array-bracket-spacing": "error",
29-
"array-callback-return": "error",
30-
"arrow-body-style": "off", // Weird style
31-
"arrow-parens": "error",
32-
"arrow-spacing": "error",
3316
"babel/new-cap": "error",
3417
"babel/no-invalid-this": "error",
35-
"block-scoped-var": "error",
36-
"block-spacing": "error",
37-
"brace-style": "error",
38-
"callback-return": "error",
39-
"camelcase": "warn",
40-
"capitalized-comments": "off",
41-
"class-methods-use-this": "error",
42-
"comma-dangle": ["error", "always-multiline"],
43-
"comma-spacing": "error",
44-
"comma-style": "error",
45-
"complexity": "error",
46-
"computed-property-spacing": "error",
47-
"consistent-return": "error",
48-
"consistent-this": "error",
49-
"constructor-super": "error",
50-
"curly": "error",
51-
"default-case": "error",
52-
"dot-location": ["error", "property"],
53-
"dot-notation": "error",
54-
"eol-last": "error",
55-
"eqeqeq": "error",
18+
"babel/object-curly-spacing": "error",
19+
"babel/semi": "off", // No thanks
5620
"flowtype/boolean-style": "error",
5721
"flowtype/define-flow-type": "error",
5822
"flowtype/delimiter-dangle": ["error", "only-multiline"],
5923
"flowtype/generic-spacing": "error",
6024
"flowtype/no-dupe-keys": "error",
6125
"flowtype/no-primitive-constructor-types": "error",
62-
"flowtype/no-weak-types": "off", // Not very useful
26+
"flowtype/no-types-missing-file-annotation": "off", // I don't need this
27+
"flowtype/no-weak-types": "error",
6328
"flowtype/object-type-delimiter": "error",
6429
"flowtype/require-parameter-type": "error",
6530
"flowtype/require-return-type": "error",
66-
"flowtype/require-variable-type": "off", // Super annoying
67-
"flowtype/semi": "off", // Super annoying
68-
"flowtype/sort-keys": "off", // Causes more work than anything else
31+
"flowtype/require-valid-file-annotation": "error",
32+
"flowtype/require-variable-type": "error",
33+
"flowtype/semi": "error",
34+
"flowtype/sort-keys": "off", // Way too much work
6935
"flowtype/space-after-type-colon": "error",
7036
"flowtype/space-before-generic-bracket": "error",
7137
"flowtype/space-before-type-colon": "error",
7238
"flowtype/type-id-match": "error",
7339
"flowtype/union-intersection-spacing": "error",
7440
"flowtype/use-flow-type": "error",
75-
"func-call-spacing": "error",
76-
"func-name-matching": "error",
77-
"func-names": "error",
78-
"func-style": ["error", "expression", {allowArrowFunctions: true}],
79-
"generator-star-spacing": "error",
80-
"global-require": "error",
81-
"guard-for-in": "error",
82-
"handle-callback-err": "error",
83-
"id-blacklist": "error",
84-
"id-length": "error",
85-
"id-match": "error",
8641
"immutable/no-let": "error",
8742
"immutable/no-mutation": "warn",
8843
"immutable/no-this": "error",
@@ -96,25 +51,83 @@ module.exports = {
9651
"import/newline-after-import": "error",
9752
"import/no-absolute-path": "error",
9853
"import/no-amd": "error",
54+
"import/no-anonymous-default-export": "error",
9955
"import/no-commonjs": "error",
10056
"import/no-deprecated": "error",
10157
"import/no-duplicates": "off", // This rule doesn't understand my style
10258
"import/no-dynamic-require": "error",
10359
"import/no-extraneous-dependencies": "error",
60+
"import/no-internal-modules": "error",
10461
"import/no-mutable-exports": "error",
10562
"import/no-named-as-default-member": "error",
10663
"import/no-named-as-default": "error",
107-
"import/no-namespace": "off", // Doesn't work with star imports?
64+
"import/no-named-default": "error",
65+
"import/no-namespace": "error",
10866
"import/no-nodejs-modules": "off", // Only for frontend
109-
"import/no-restricted-paths": "off", // Isn't quite helpful
67+
"import/no-restricted-paths": "error",
11068
"import/no-unassigned-import": "error",
11169
"import/no-unresolved": "error",
11270
"import/no-webpack-loader-syntax": "error",
11371
"import/order": "error",
11472
"import/prefer-default-export": "error",
11573
"import/unambiguous": "error",
74+
"promise/always-return": "error",
75+
"promise/avoid-new": "error",
76+
"promise/catch-or-return": "error",
77+
"promise/no-callback-in-promise": "error",
78+
"promise/no-native": "off", // We have babel
79+
"promise/no-nesting": "error",
80+
"promise/no-promise-in-callback": "error",
81+
"promise/no-return-wrap": "error",
82+
"promise/param-names": "error",
83+
"promise/prefer-await-to-callbacks": "off", // Not convinced of await/async
84+
"promise/prefer-await-to-then": "off", // Not convinced of await/async
85+
"accessor-pairs": "error",
86+
"array-bracket-newline": ["error", "always"],
87+
"array-bracket-spacing": "error",
88+
"array-callback-return": "error",
89+
"array-element-newline": "error",
90+
"arrow-body-style": "off", // Weird style
91+
"arrow-parens": "error",
92+
"arrow-spacing": "error",
93+
"block-scoped-var": "error",
94+
"block-spacing": "error",
95+
"brace-style": "error",
96+
"callback-return": "error",
97+
"camelcase": "warn",
98+
"capitalized-comments": "off", // What a stupid rule
99+
"class-methods-use-this": "error",
100+
"comma-dangle": ["error", "always-multiline"],
101+
"comma-spacing": "error",
102+
"comma-style": "error",
103+
"complexity": "error",
104+
"computed-property-spacing": "error",
105+
"consistent-return": "error",
106+
"consistent-this": "error",
107+
"constructor-super": "error",
108+
"curly": "error",
109+
"default-case": "error",
110+
"dot-location": ["error", "property"],
111+
"dot-notation": "error",
112+
"eol-last": "error",
113+
"eqeqeq": "error",
114+
"for-direction": "error",
115+
"func-call-spacing": "error",
116+
"func-name-matching": "error",
117+
"func-names": "error",
118+
"func-style": ["error", "expression", {allowArrowFunctions: true}],
119+
"function-paren-newline": ["error", "consistent"],
120+
"generator-star-spacing": "error",
121+
"getter-return": "error",
122+
"global-require": "error",
123+
"guard-for-in": "error",
124+
"handle-callback-err": "error",
125+
"id-blacklist": "error",
126+
"id-length": "error",
127+
"id-match": "error",
116128
"indent": ["error", 2, {"SwitchCase": 1}],
117129
"init-declarations": "error",
130+
"jsx-quotes": "error",
118131
"key-spacing": "error",
119132
"keyword-spacing": "error",
120133
"line-comment-position": "error",
@@ -138,10 +151,12 @@ module.exports = {
138151
"no-array-constructor": "error",
139152
"no-await-in-loop": "error",
140153
"no-bitwise": "off", // Doesn't work with pipes
154+
"no-buffer-constructor": "error",
141155
"no-caller": "error",
142156
"no-case-declarations": "error",
143157
"no-catch-shadow": "error",
144158
"no-class-assign": "error",
159+
"no-compare-neg-zero": "error",
145160
"no-cond-assign": "error",
146161
"no-confusing-arrow": "error",
147162
"no-console": "warn",
@@ -214,7 +229,7 @@ module.exports = {
214229
"no-path-concat": "error",
215230
"no-plusplus": "error",
216231
"no-process-env": "off", // What a stupid rule
217-
"no-process-exit": "error",
232+
"no-process-exit": "off", // What a stupid rule
218233
"no-proto": "error",
219234
"no-prototype-builtins": "error",
220235
"no-redeclare": "error",
@@ -267,6 +282,7 @@ module.exports = {
267282
"no-warning-comments": "error",
268283
"no-whitespace-before-property": "error",
269284
"no-with": "error",
285+
"nonblock-statement-body-position": "error",
270286
"object-curly-newline": "error",
271287
"object-curly-spacing": "error",
272288
"object-property-newline": "error",
@@ -275,8 +291,10 @@ module.exports = {
275291
"one-var": ["error", "never"],
276292
"operator-assignment": "error",
277293
"operator-linebreak": "off", // Doesn't work with pipes
294+
"padded-blocks": "error",
278295
"padded-blocks": ["error", "never"],
279-
"prefer-arrow-callback": "off", // This really isn't an appropriate rule
296+
"padding-line-between-statements": "error",
297+
"prefer-arrow-callback": "error",
280298
"prefer-const": "error",
281299
"prefer-destructuring": "error",
282300
"prefer-numeric-literals": "error",
@@ -293,9 +311,9 @@ module.exports = {
293311
"require-yield": "error",
294312
"rest-spread-spacing": "error",
295313
"semi-spacing": "error",
314+
"semi-style": "error",
296315
"semi": ["error", "never"],
297-
"sort-imports": "off", // I don't like making busy work for myself
298-
"sort-keys": "off", // I don't like making busy work for myself
316+
"sort-imports": "off", // Not worth the hassle
299317
"sort-vars": "off", // I don't like making busy work for myself
300318
"space-before-blocks": "error",
301319
"space-before-function-paren": "error",
@@ -304,6 +322,7 @@ module.exports = {
304322
"space-unary-ops": "error",
305323
"spaced-comment": "error",
306324
"strict": ["error", "never"],
325+
"switch-colon-spacing": "error",
307326
"symbol-description": "error",
308327
"template-curly-spacing": "error",
309328
"template-tag-spacing": "error",

0 commit comments

Comments
 (0)