-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.yml
317 lines (307 loc) · 11 KB
/
.eslintrc.yml
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
env:
es6: true
node: true
mocha: true
parserOptions:
ecmaVersion: 8
sourceType: script
rules:
# Errors break builds and prevent tests from running, so on occasion,
# warn is used to allow tests/builds to run during development,
# even though it's an error.
# Possible Errors
no-await-in-loop: error
no-compare-neg-zero: error
no-cond-assign: error
no-console: warn # debugging happens
no-constant-condition: error
no-control-regex: off # too edge to care
no-debugger: warn # debugging happens
no-dupe-args: error
no-dupe-keys: error
no-duplicate-case: error
no-empty: error
no-empty-character-class: error
no-ex-assign: error
no-extra-boolean-cast: error
no-extra-parens:
- error
- all
- conditionalAssign: false
nestedBinaryExpressions: false
ignoreJSX: multi-line
no-extra-semi: error
no-func-assign: error
no-inner-declarations: off # excellent way to control scope/code-complexity
no-invalid-regexp: error
no-irregular-whitespace: error
no-obj-calls: error
no-prototype-builtins: warn # prototype-less objects are a thing
no-regex-spaces: error
no-sparse-arrays: off # fixed length arrays are a thing
no-template-curly-in-string: error
no-unexpected-multiline: error
no-unreachable: error
no-unsafe-finally: error
no-unsafe-negation: error
use-isnan: error
valid-jsdoc: off # in favor of docco
valid-typeof: error
# Best Practices
accessor-pairs: error
array-callback-return: error
block-scoped-var: error
class-methods-use-this: warn # disable in file if intentional
complexity: [ warn, 20 ]
consistent-return: error
curly: [ error, all ]
default-case: off # do not always make sense (i.e. which switches return)
dot-location: [ error, property ]
dot-notation: error
eqeqeq: error
guard-for-in: warn # just be careful and disable in file if intentional
no-alert: error
no-caller: error
no-case-declarations: error
no-div-regex: off # don't care
no-else-return: error
no-empty-function: error
no-empty-pattern: error # irrelevant since destructuring is disallowed
no-eq-null: error
no-eval: error
no-extend-native: error
no-extra-bind: error
no-extra-label: error
no-fallthrough: error # this just forces a comment explaining why
no-floating-decimal: error
no-global-assign: error
no-implicit-coercion: error
no-implicit-globals: error
no-implied-eval: error
no-invalid-this: off # flags too many legitimate uses
no-iterator: error
no-labels: error
no-lone-blocks: error
no-loop-func: error
no-magic-numbers: off # flags too many legitimate uses
no-multi-spaces: error
no-multi-str: error
no-new: error
no-new-func: error
no-new-wrappers: error # disable in file & explain if need a primitive ref
no-octal: error
no-octal-escape: error
no-param-reassign: error
no-proto: error
no-redeclare: error
no-restricted-properties: off # maybe use this in the future
no-return-assign: off # useful in memoization & setters
no-return-await: error
no-script-url: error
no-self-assign: error
no-self-compare: error
no-sequences: error
no-throw-literal: error
no-unmodified-loop-condition: error
no-unused-expressions: off # prevents expression chaining
no-unused-labels: error
no-useless-call: error
no-useless-concat: error
no-useless-escape: error
no-useless-return: error
no-void: error
no-warning-comments:
- warn
- terms:
- 'todo'
- 'fixme'
- 'xxx'
location: 'anywhere'
no-with: error
prefer-promise-reject-errors: error
radix: off # irrelevant in IE9+
require-await: error
vars-on-top: off # makes it unclear where vars come from and their scope
wrap-iife: [ error, outside ]
yoda: off
# - error
# - never
# - onlyEquality: true # would prefer inequality also
# Strict Mode
strict: off # implied
# Variables
init-declarations: off # init'ed and non-init'd are needed
no-catch-shadow: error
no-delete-var: error
no-label-var: error
no-restricted-globals: error
no-shadow: error
no-shadow-restricted-names: error
no-undef: error
no-undef-init: error
no-undefined: off # ecmascript 3 is too old to be a consideration
no-unused-vars:
- warn # mid-development unused vars shouldn't block the build
- args: none
no-use-before-define: off # hoisting helps make code more self-documenting,
# and also creates a nice header/toc
# Node.js and CommonJS
callback-return: error
global-require: off # pass into an iife at the bottom of the module
handle-callback-err: error
no-mixed-requires: error
no-new-require: error
no-path-concat: error
no-process-env: error
no-process-exit: error
no-restricted-modules: off # maybe use this in the future
no-sync: error
# Stylistic Issues
array-bracket-spacing: [ error, always ]
block-spacing: error
brace-style: error
camelcase: off # use snake_case for benefit of non-native English speakers
capitalized-comments: off # usually, but not always, so...
comma-dangle:
- error
- arrays: always-multiline
objects: always-multiline
imports: always-multiline
exports: always-multiline
functions: always-multiline
comma-spacing: [ error, { before: false , after: true } ]
comma-style: [ error, last ]
computed-property-spacing: off # would prefer "always" unless var/literal
consistent-this: off # use `thisThing` where "Thing" is descriptive
eol-last: [ error, always ]
func-call-spacing: [ error, never ]
func-name-matching: off # not useful
func-names: error
func-style:
- error
- declaration
- allowArrowFunctions: false
id-blacklist: off # maybe use this in the future
id-length: off # legitimate 1 char & many char ids
id-match: off # maybe use this in the future
indent:
- error
- 4 # 2 is difficult for some eyes to read + 4 discourages deep nesting
- SwitchCase: 1
jsx-quotes: [ error, prefer-double ]
key-spacing:
- error
- beforeColon: false
afterColon: true
keyword-spacing:
- error
- before: true
after: true
line-comment-position: off # both are useful
linebreak-style: error
lines-around-comment: off # too troublesome during development
lines-around-directive:
- error
- before: never
after: always
max-depth: [ warn, { max: 4 } ]
max-len: [ error, 80 ]
max-lines: [ warn, 300 ]
max-nested-callbacks: [ warn, 3 ]
max-params: [ error, 3 ]
max-statements: [ warn, 15, { ignoreTopLevelFunctions: true } ]
max-statements-per-line: [ warn, { max: 1 } ]
multiline-ternary: off # multiline is more readable than single line
new-cap: off # coercion happens (e.g. Integer(number))
new-parens: off # does not reduce clarity to omit
newline-after-var: off # both make sense
newline-before-return: off # does not increase clarity
newline-per-chained-call: off # let line length govern this
no-array-constructor: error
no-bitwise: warn # sometimes it's a good idea, disable in file if needed
no-continue: error
no-inline-comments: off # useful for short comments
no-lonely-if: error
no-mixed-operators: off
no-mixed-spaces-and-tabs: error
no-multi-assign: off # sometimes good to do
no-multiple-empty-lines:
- warn
- max: 3
maxBOF: 0
maxEOF: 1
no-negated-condition: off # sometimes it's clearer
no-nested-ternary: off # nested ternary is super readable and useful
no-new-object: error
no-plusplus: off # obviously
no-restricted-syntax: off # maybe use this in the future
no-tabs: error
no-ternary: off # obviously
no-trailing-spaces: error
no-underscore-dangle: off
no-unneeded-ternary: error
no-whitespace-before-property: error
nonblock-statement-body-position: off # irrelevant cause curly is set to all
object-curly-newline: off # unpredictable behavior
object-curly-spacing: [ error, always ]
object-property-newline: off # if object can fit on a 80-char line, all good
one-var: [ error, never ]
one-var-declaration-per-line: [ error, initializations ]
operator-assignment: [ error, always ]
operator-linebreak: [ error, before ]
padded-blocks: [ error, never ]
quote-props: [ error, as-needed ]
quotes: [ error , single, { allowTemplateLiterals: true } ]
require-jsdoc: off # in favor of docco
semi: [ error, always ]
semi-spacing: error
sort-keys: off # allow logical sorting
sort-vars: off # allow logical sorting
space-before-blocks: error
space-before-function-paren:
- error
- anonymous: always
named: never
asyncArrow: always
space-in-parens: off # sometimes use 'em, sometimes don't
space-infix-ops: error
space-unary-ops: error
spaced-comment: [ error, always, { markers: [ '/' ] } ]
template-tag-spacing: [ error, always ]
unicode-bom: [ error, never ]
wrap-regex: off # /foo/.test('bar') is clearly not division
# ECMAScript 6+
# Many ES6 features center around cramming logic into as few characters
# as possible on a single line, at the expense of readability and clarity.
# Discourage/ban those features where possible.
arrow-body-style: [ error, never ] # irrelevant cause func-style
arrow-parens: error # irrelevant cause func-style
arrow-spacing: error # irrelevant cause func-style
constructor-super: off # invalid call check is good, but don't require it
generator-star-spacing: [ error, { before: true, after: false } ]
no-class-assign: error
no-confusing-arrow: error # irrelevant cause func-style
no-const-assign: error
no-dupe-class-members: error
no-duplicate-imports: error
no-new-symbol: error
no-restricted-imports: off # maybe use this in the future
no-this-before-super: off # logic may need to be before and/or after super
no-useless-computed-key: error
no-useless-constructor: error
no-useless-rename: error # irrelevant cause force node require/module.export
no-var: error
object-shorthand: [ error, always ]
prefer-arrow-callback: off # irrelevant cause func-style
prefer-const: error
prefer-destructuring: off # reduces clarity, sometimes dramatically #fuckit
prefer-numeric-literals: error
prefer-rest-params: error # disallow arguments magic variable
prefer-spread: error
prefer-template: error
require-yield: error
rest-spread-spacing: error
sort-imports: off # allow logical sorting
symbol-description: error
template-curly-spacing: [ error, always ]
yield-star-spacing: [ error, before ]