-
Notifications
You must be signed in to change notification settings - Fork 14
/
.eslintrc.json
273 lines (273 loc) · 16.7 KB
/
.eslintrc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
{
"rules": { // And why they're best practice (alphabetized).
"accessor-pairs": [2, {"getWithoutSet": true}], // omission is usually by mistake.
"array-bracket-spacing": 2, // spaces can make arrays take up a lot of space, and concise code allows for more reading context.
"array-callback-return": 2, // omission is usually by mistake.
"arrow-body-style": [2, "as-needed"], // improves consistency and readability.
// "arrow-parens": [2, "as-needed"], // allows for concise arrows while improving consistency.
"arrow-spacing": 2, // improves consistency and readability.
"block-scoped-var": 2, // can behave unexpectedly due to variable hoisting.
"block-spacing": 2, // helps differentiate blocks (spaced) from objects (not spaced).
"brace-style": [2, "1tbs", {"allowSingleLine": true}], // common and concise.
"callback-return": [2, ["callback", "cb", "next"]], // usually returns control to cb, so best to return out of function as well.
// "camelcase": 2, // camelCase is JS convention, and this still allows capcase constants.*/
"comma-dangle": 2, // causes bug in IE8.
"comma-spacing": 2, // improves consistency.
"comma-style": [2, "last"], // improves consistency.
"complexity": 1, // code with high cyclomatic complexity is difficult to reason about.
"computed-property-spacing": 2, // usually a typo.
"consistent-return": 0, // reduces ambiguity about what gets returned.
"consistent-this": [2, "context"], // enforces a standard var for capturing context (which should be done sparingly).
"constructor-super": 2, // catches runtime syntax errors.
"curly": 2, // reduces ambiguity around blocks and line breaks.
"default-case": 2, // not having default (and break) lead to unexpected results.
"dot-location": [2, "property"], // easier to notice . at the beginning of a line.
"dot-notation": 2, // easier to read.
"eol-last": 2, // aids in file concatination; github complains without this.
"eqeqeq": 2, // avoids unexpected type coercion.
"func-names": 2, // having named functions makes following stack traces much easier.
"func-style": [0, "declaration"], // differentiates funcs from consts; hoisting allows more readable code ordering.
// "generator-star": 0, // removed.
"generator-star-spacing": [2, {"before": false, "after": true}], // standard on MDN docs.
"global-require": 2, // avoid unexpected sync file load.
// "global-strict": 0, // removed.
"guard-for-in": 0, // protects against looping over props up prototype chain.
"handle-callback-err": [2, "^.*(e|E)rr"], // often omitted in error.
"id-blacklist": 0, // will add variable names to this list if abused.
"id-length": 0, // variable naming is difficult enough without limits.
"id-match": 0, // covered by camelCase.
"indent": [2, 2], // improves consistency.
"init-declarations": 2, // not assigning an initialized variable should be explicit, not a mistake.
"jsx-quotes": 2, // improves consistency; more common to have to quote single quotes than double so double is default.
"key-spacing": 2, // improves consistency.
"keyword-spacing": 2, // distinguishes keyword invocation from function invocation.
"linebreak-style": [2, "unix"], // improves consistency; prevents windows users from introducing \r.
"lines-around-comment": 0, // comments are bad enough; don't give them extra padding.
"max-depth": [1, 4], // deeply nested code can be difficult to read.
"max-len": [0, {"code": 100, "ignoreTrailingComments": true, "ignoreUrls": true}], // vertically-concise code gives reader more context.
"max-nested-callbacks": [1, 2], // a sign that the nested code should be refactored out.
"max-params": 0, // better to have many params than obscure them with a config object.
// "max-statements": [1, 10], // functions should be focused and concise. #TODO enable this rule.
// "max-statements-per-line": 2, // improves readability; exceptions should be explicitly noted.
// "new-cap": 2, // makes it easy to tell if a function is a constructor requiring the new keyword. #TODO enable this rule.
"new-parens": 2, // usually omitted by mistake.
"newline-after-var": 0, // improves consistency; concise code gives reader more context.
"newline-before-return": 0, // vertical space is too precious to be wasted.
"newline-per-chained-call": 0, // some chained calls belong together.
"no-alert": 2, // alerts are annoying.
"no-array-constructor": 2, // can do surprising things; better to use [].
// "no-arrow-condition": 0, // removed.
"no-bitwise": 2, // these are usually typos; can be difficult to reason about.
"no-caller": 2, // deprecated.
"no-case-declarations": 0, // can lead to unexpected behavior.
"no-catch-shadow": 2, // causes a bug in IE8.
"no-class-assign": 2, // usually a typo.
// "no-comma-dangle": 0, // removed.
"no-cond-assign": 0, // usually typos.
"no-confusing-arrow": [1, {"allowParens": true}], // avoids typos and ambiguity while allowing concise syntax.
"no-console": 1, // for debugging only; shouldn't be committed.
"no-const-assign": 2, // catches runtime syntax errors.
"no-constant-condition": 0, // unnecessary; usually a typo.
"no-continue": 2, // makes reasoning about loops more difficult.
"no-control-regex": 2, // usually a typo.
"no-debugger": 1, // for debugging only; shouldn't be committed.
"no-delete-var": 2, // only properties should be deleted.
"no-div-regex": 0, // regex are difficult enough; also operator-assignment disallows /= operator.
"no-dupe-args": 1, // shadowing increases ambiguity.
"no-dupe-class-members": 2, // can behave unexpectedly, probably a typo.
"no-dupe-keys": 2, // can cause unexpected behavior.
"no-duplicate-case": 2, // almost certainly a mistake.
"no-duplicate-imports": 2, // should be consolidated for brevity.
"no-else-return": 0, // explicit conditional paths are better than implicit.
"no-empty": 2, // probably a mistake.
"no-empty-character-class": 2, // probably a typo.
// "no-empty-class": 0, // removed.
"no-empty-function": 1, // probably a mistake.
// "no-empty-label": 0, // removed.
"no-empty-pattern": 2, // looks like object but is in fact noop.
"no-eq-null": 2, // use strict equality.
"no-eval": 2, // eval is often unsafe and performs poorly.
"no-ex-assign": 2, // overwriting params is usually bad; can obscure errors.
"no-extend-native": 2, // can cause unexpected behavior for other devs.
"no-extra-bind": 2, // removes useless code.
"no-extra-boolean-cast": 2, // unnecessary.
"no-extra-label": 2, // don't use labels
"no-extra-parens": 0, // parens can be useful for decreasing ambiguity.
"no-extra-semi": 2, // probably a typo.
// "no-extra-strict": 0, // removed.
"no-fallthrough": 2, // catches mistakes that lead to unexpected behavior.
"no-floating-decimal": 2, // looks too much like dot operator.
"no-func-assign": 2, // probably a typo.
"no-implicit-coercion": 2, // avoids fancy coercion tricks that inhibit readability.
"no-implicit-globals": 0, // modules make this rule unnecessary.
"no-implied-eval": 2, // eval is often unsafe and performs poorly.
"no-inline-comments": 0, // helps prevent post-refactor orphaned comments.
"no-invalid-regexp": 2, // the more checks on regex correctness the better.
"no-inner-declarations": 2, // avoids unexpected behavior.
// "no-invalid-this": 1, // avoids possible undefined or typeerror this.
"no-irregular-whitespace": 1, // improves consistency.
"no-iterator": 2, // this feature is obsolete and not widely supported.
"no-label-var": 2, // a bad feature related to loop control flow, like GOTO.
"no-labels": 2, // a bad feature related to loop control flow, like GOTO.
"no-lone-blocks": 2, // unless in es6, these are just useless clutter.
"no-lonely-if": 2, // extra-verbose and unusual.
"no-loop-func": 2, // functions in loops are difficult to reason about.
"no-magic-numbers": 0, // what the number represents gets lost.
"no-mixed-requires": 1, // group requires and seperate from other init for clearer code.
"no-mixed-spaces-and-tabs": 2, // just spaces for consistency.
"no-multi-spaces": 2, // these are almost always typos.
"no-multi-str": 2, // use newline chars or template strings instead.
"no-multiple-empty-lines": 2, // concise code gives reader more context.
"no-native-reassign": 2, // can cause unexpected behavior for other devs.
"no-negated-condition": 2, // improves reasonability.
"no-negated-in-lhs": 2, // reduces ambiguity and typos.
"no-nested-ternary": 2, // improves reasonability.
"no-new": 2, // using new for side effects is bad because side effects are bad and OO is bad.
"no-new-func": 2, // eval is often unsafe and performs poorly.
"no-new-object": 2, // use more concise {} instead.
"no-new-require": 2, // unusual; just use require.
"no-new-symbol": 2, // should be called as a function without new.
"no-new-wrappers": 2, // does not do what it looks like it does.
"no-obj-calls": 2, // part of the spec.
"no-octal": 2, // can be confusing.
"no-octal-escape": 2, // deprecated.
"no-param-reassign": 0, // useful for guarding a function.
"no-path-concat": 2, // breaks for non-unix system.
"no-plusplus": 2, // may cause semicolon issues, and can be expressed more explicitly.
"no-process-env": 2, // global deps are bad; better to use config files.
"no-process-exit": 2, // too drastic; almost always better to throw and handle.
"no-proto": 2, // deprecated.
"no-redeclare": [2, {"builtinGlobals": true}], // probably a mistake; should use const/let instead anyway.
"no-regex-spaces": 2, // probably a typo.
// "no-reserved-keys": 0, // removed.
"no-restricted-globals": 0, // not (yet) necessary.
"no-restricted-imports": 0, // not (yet) necessary.
"no-restricted-modules": 0, // not (yet) necessary.
"no-restricted-syntax": [0, "TryStatement"], // try-catch makes tracing errors difficult (see http://j.mp/thriftthrow).
"no-return-assign": [2, "always"], // can cover up typos.
"no-script-url": 2, // eval is often unsafe and performs poorly.
"no-self-assign": 2, // no effect; probably a typo.
"no-self-compare": 2, // usually a typo; better to use isNaN.
"no-sequences": 2, // usually a typo; obscures side effects.
"no-shadow": 2, // difficult to read, limits access to higher scope vars.
"no-shadow-restricted-names": 2, // should not mess with restricted.
// "no-space-before-semi": 0, // removed.
"no-sparse-arrays": 2, // usually typos.
"no-spaced-func": 0, // space between func and params differentiates declaration from invocation.
"no-sync": 2, // blocks single thread; use async.
"no-ternary": 0, // ternaries more concise and more strict than if/else.
"no-this-before-super": 2, // catches a reference error.
"no-throw-literal": 2, // be consistent about only throwing Error objects.
"no-trailing-spaces": 2, // unnecessary; github doesn't like them.
"no-undef": 0, // catches ReferenceErrors.
"no-undef-init": 2, // unnecessary.
"no-undefined": 2, // better to check typeof
"no-underscore-dangle": 0, // should not rely on variable name to reason about scoping, as it may change.
"no-unexpected-multiline": 2, // prevents issues related to semicolons.
"no-unmodified-loop-condition": 2, // possible infinite loop; probably a mistake.
"no-unneeded-ternary": 2, // improves consistency and readability.
"no-unreachable": 2, // helps keep things clean during refactoring.
"no-unsafe-finally": 2, // leads to unexpected behavior.
"no-unused-expressions": 2, // usually a typo; has o effect.
"no-unused-labels": 2, // don't use labels.
"no-unused-vars": 2, // probably a mistake.
"no-use-before-define": [2, {"functions": false}], // avoids temporal dead zone; functions below can improve readability.
"no-useless-call": 2, // slower than normal invocation.
"no-useless-computed-key": 2, // unnecessary; can cause confusion.
"no-useless-concat": 2, // slower than static combination.
"no-useless-constructor": 2, // unnecessary.
"no-useless-escape": 2, // makes code easier to read.
"no-var": 2, // const is best, and let is useful for counters, but they eclipse var's uses. #ES6only
"no-void": 2, // unusual and unnecessary.
"no-warning-comments": 2, // warning comments should be addressed before merge (or moved out of code).
"no-whitespace-before-property": 2, // typos.
"no-with": 2, // can add unexpected variables to scope.
// "no-wrap-func": 0, // removed.
"object-curly-spacing": 2, // helps differentiate blocks (spaced) from objects (not spaced).
"object-shorthand": 2, // increases consistency. #ES6only
"one-var": 0, // grouped statement types are more consistent and readable.
"one-var-declaration-per-line": 0, // superceded by one-var.
"operator-assignment": [2, "never"], // better to be explicit about what is happening than relying on shorthand.
"operator-linebreak": [0],
"padded-blocks": [0, "never"], // concise code gives reader more context.
"prefer-arrow-callback": 2, // increases readability and consistency.
"prefer-const": 2, // better to be explicit about what is expected to change.
// "prefer-reflect": 2, // old versions are deprecated. #TODO enable this rule.
"prefer-rest-params": 2, // easier to read than slicing args. #ES6only
"prefer-spread": 2, // avoids unneecessary call and apply.
"prefer-template": 2, // string concatenation is slow and error-prone. #ES6only
"quote-props": [2, "as-needed"], // improves consistency and readability.
"quotes": [2, "double"], // improves consistency; more common to have to quote single quotes than double so double is default.
"radix": 2, // should be explicit about what kind of int is being parsed.
"require-jsdoc": 0, // not using jsdoc.
"require-yield": 2, // omission is probably a mistake.
"semi": [2, "never"], // unnecessary due to ASI; improves consistency and readability.
"semi-spacing": 2, // improves consistency.
"sort-imports": [0, {"ignoreCase": true}], // improves consistency, readability.
"sort-vars": 0, // improves consistency.
// "space-after-function-name": 0, // removed.
// "space-after-keywords": 0, // removed.
"space-before-blocks": 2, // makes things look consistent with keyword spacing.
// "space-before-function-paren": 2, // distinguishes keyword invocation from function invocation.
// "space-before-function-parentheses": 0, // removed.
// "space-before-keywords": 0, // removed.
// "space-in-brackets": 0, // removed.
"space-in-parens": 2, // increases consistency.
"space-infix-ops": 2, // increases consistency, avoids unexpected behavior due to typos.
// "space-return-throw-case": 0, // removed.
"space-unary-ops": 2, // unusual, improves consistency.
// "space-unary-word-ops": 0, // removed.
"spaced-comment": 2, // improves consistency.
// "spaced-line-comment": 0, // removed.
"strict": [0, "global"], // unnecessary when babbling.
"template-curly-spacing": 2, // makes code concise, and therefore more readable.
"use-isnan": 2, // comparing to NaN can be difficult to reason about.
"valid-jsdoc": 0, // not using jsdoc.
"valid-typeof": 2, // there are ways to type-check, but will least prevent typos.
"vars-on-top": 2, // best to have code agree with hoisting.
"wrap-iife": [2, "inside"], // make IIFE's more obvious; inside fits standard invocation syntax better.
"wrap-regex": 2, // avoids possible confusion with comments or division operator.
"yield-star-spacing": [2, {"before": false, "after": true}], // standard on MDN docs.
"yoda": 2 // improves readability and consistency.
},
"env": {
"es6": true,
"browser": true,
"node": true,
"jasmine": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"jsx": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"octalLiterals": true,
"regexUFlag": true,
"regexYFlag": true,
"restParams": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
"unicodeCodePointEscapes": true,
"globalReturn": true,
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"extends": "eslint:recommended",
"globals": {
"Generator": true
}
}