-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
394 lines (378 loc) · 12.9 KB
/
.eslintrc
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
---
parser: babel-eslint
env:
browser: true
node: true
jest: true
jasmine: true
es6: true
plugins:
- react
globals:
__DEV__: true
chrome: true
window: true
# Flow globals
$Enum: true
$FixMe: true
$FlowFixMe: true
$FlowIssue: true
$Keys: true
Iterator: true
IteratorResult: true
# Flow globals for React
ReactClass: true
ReactElement: true
SyntheticClipboardEvent: true
SyntheticCompositionEvent: true
SyntheticDragEvent: true
SyntheticEvent: true
SyntheticFocusEvent: true
SyntheticInputEvent: true
SyntheticKeyboardEvent: true
SyntheticMouseEvent: true
SyntheticWheelEvent: true
SyntheticTouchEvent: true
SyntheticUIEvent: true
rules:
# Possible Errors <http://eslint.org/docs/rules/#possible-errors>
# babel removes them for older browsers, we should do a codemod
comma-dangle: [1, always-multiline]
# equivalent to jshint boss
no-cond-assign: 0
# equivalent to jshint devel
no-console: 0
# prohibits things like `while (true)`
no-constant-condition: 0
# we need to be able to match these
no-control-regex: 0
# equivalent to jshint debug
no-debugger: 2
# equivalent to jshint W004
no-dupe-args: 2
# syntax error in strict mode, almost certainly unintended in any case
no-dupe-keys: 2
# almost certainly a bug
no-duplicate-case: 1
# almost certainly a bug
no-empty-character-class: 1
# would warn on uncommented empty `catch (ex) {}` blocks
no-empty: 0
# can cause subtle bugs in IE 8, and we shouldn't do this anyways
no-ex-assign: 1
# we shouldn't do this anyways
no-extra-boolean-cast: 1
# parens may be used to improve clarity, equivalent to jshint W068
no-extra-parens: [1, functions]
# equivalent to jshint W032
no-extra-semi: 1
# a function delaration shouldn't be rewritable
no-func-assign: 2
# babel and es6 allow block-scoped functions
no-inner-declarations: 0
# will cause a runtime error
no-invalid-regexp: 1
# disallow non-space or tab whitespace characters
no-irregular-whitespace: 1
# write `if (!(a in b))`, not `if (!a in b)`, equivalent to jshint W007
no-negated-in-lhs: 2
# will cause a runtime error
no-obj-calls: 2
# improves legibility
no-regex-spaces: 1
# we target es6!
no-reserved-keys: 0
# equivalent to jshint elision
no-sparse-arrays: 2
# equivalent to jshint W027
no-unreachable: 2
# equivalent to jshint use-isnan
use-isnan: 2
# probably too noisy ATM
valid-jsdoc: 0
# equivalent to jshint notypeof
valid-typeof: 2
# we already require semicolons
no-unexpected-multiline: 0
jsx-quotes: [2, prefer-double]
no-dupe-class-members: 2
no-restricted-syntax: [2, WithStatement]
# Best Practices <http://eslint.org/docs/rules/#best-practices>
# probably a bug, we shouldn't actually even use this yet, because of IE8
accessor-pairs: 0
# probably too noisy ATM
block-scoped-var: 0
# cyclomatic complexity, we're too far gone
complexity: 0
# require return statements to either always or never specify values
consistent-return: 2
# style guide: Always use brackets, even when optional.
curly: [2, all]
# we don't do this/care about this
default-case: 0
# disabled in favor of our temporary fork
dot-notation: 2
# we don't do this/care about this, but probably should eventually
dot-location: [2, property]
# disabled as it's too noisy ATM
eqeqeq: [2, allow-null]
# we don't do this/care about this, equivalent to jshint forin
guard-for-in: 0
# we have too many internal examples/tools using this
no-alert: 0
# incompatible with use strict equivalent to jshint noarg
no-caller: 2
# we don't do this/care about this
no-div-regex: 0
# we don't do this/care about this
no-else-return: 0
# see eqeqeq: we explicitly allow this, equivalent to jshint eqnull
no-eq-null: 0
# equivalent to jshint evil
no-eval: 2
# should only be triggered on polyfills, which we can fix case-by-case
no-extend-native: 1
# might be a sign of a bug
no-extra-bind: 1
# equivalent to jshint W089
no-fallthrough: 1
# equivalent to jshint W008
no-floating-decimal: 2
# implicit coercion is often idiomatic
no-implicit-coercion: 0
# equivalent to jshint evil/W066
no-implied-eval: 2
# will likely create more signal than noise
no-invalid-this: 0
# babel should handle this fine
no-iterator: 0
# don't use labels
no-labels: 2
# lone blocks create no scope, will ignore blocks with let/const
no-lone-blocks: 1
# equivalent to jshint loopfunc
no-loop-func: 0
# we may use this for alignment in some places
no-multi-spaces: 1
# equivalent to jshint multistr, consider using es6 template strings
no-multi-str: 2
# equivalent to jshint W020, similar to no-extend-native
no-native-reassign: [2, {exceptions: [Map, Set]}]
# equivalent to jshint evil/W054
no-new-func: 2
# don't use constructors for side-effects, equivalent to jshint nonew
no-new: 1
# deprecated in ES5, but we still use it in some places
no-octal-escape: 1
# deprecated in ES5, may cause unexpected behavior
no-octal: 1
# treats function parameters as constants, probably too noisy ATM
no-param-reassign: 0
# only relevant to node code
no-process-env: 0
# deprecated in ES3.1, equivalent to jshint proto
no-proto: 2
# jshint doesn't catch this, but this is inexcusable
no-redeclare: 2
# equivalent to jshint boss
no-return-assign: 0
# equivalent to jshint scripturl
no-script-url: 2
# not in jshint, but is in jslint, and is almost certainly a mistake
no-self-compare: 1
# there are very limited valid use-cases for this
no-sequences: 1
# we're already pretty good about this, and it hides stack traces
no-throw-literal: 1
# breaks on `foo && foo.bar()` expression statements, which are common
no-unused-expressions: 2
# disallow unnecessary .call() and .apply()
no-useless-call: 1
# this has valid use-cases, eg. to circumvent no-unused-expressions
no-void: 0
# this journey is 1% finished (allow TODO comments)
no-warning-comments: 0
# equivalent to jshint withstmt
no-with: 0
# require radix argument in parseInt, we do this in most places already
radix: 1
# we don't do this/care about this
vars-on-top: 0
# equivalent to jshint immed
wrap-iife: 0
# probably too noisy ATM
yoda: 0
# Strict Mode <http://eslint.org/docs/rules/#strict-mode>
# jshint wasn't checking this, and the compiler should add this anyways
strict: [1, global]
# Variables <http://eslint.org/docs/rules/#variables>
# we don't do this/care about this
init-declarations: 0
# equivalent to jshint W002, catches an IE8 bug
no-catch-shadow: 2
# equivalent to jshint W051, is a strict mode violation
no-delete-var: 2
# we should avoid labels anyways
no-label-var: 1
# redefining undefined, NaN, Infinity, arguments, and eval is bad, mkay?
no-shadow-restricted-names: 1
# a definite code-smell, but probably too noisy
no-shadow: 2
# it's nice to be explicit sometimes: `var foo = undefined;`
no-undef-init: 0
# equivalent to jshint undef, turned into an error in getConfig
# NOTE: This diverges from internal - just turned into an error here since we
# almost always do that anyway.
no-undef: 2
# using undefined is safe because we enforce no-shadow-restricted-names
no-undefined: 0
# equivalent to jshint unused
no-unused-vars: [2, {args: none}]
# too noisy
no-use-before-define: 0
# Node.js <http://eslint.org/docs/rules/#nodejs>
# TODO: turn some of these on in places where we lint node code
callback-return: 0
handle-callback-err: 0
no-mixed-requires: 0
no-new-require: 0
no-path-concat: 0
no-process-exit: 0
no-restricted-modules: 0
no-sync: 0
# Stylistic Issues <http://eslint.org/docs/rules/#stylistic-issues>
# See also: https://our.intern.facebook.com/intern/dex/style-guide/
array-bracket-spacing: 1
brace-style: [1, 1tbs]
# too noisy at the moment, and jshint didn't check it
camelcase: [0, {properties: always}]
comma-spacing: [1, {before: false, after: true}]
# jshint had laxcomma, but that was against our style guide
comma-style: [1, last]
computed-property-spacing: [1, never]
# we may use more contextually relevant names for this than self
consistent-this: [0, self]
# should be handled by a generic TXT linter instead
eol-last: 1
func-names: 0
# too noisy ATM
func-style: [0, declaration]
# we weren't enforcing this with jshint, so erroring would be too noisy
indent: [1, 4, {SwitchCase: 1}]
# we may use extra spaces for alignment
key-spacing: [0, {beforeColon: false, afterColon: true}]
lines-around-comment: 0
# should be handled by a generic TXT linter instead
linebreak-style: [0, unix]
max-nested-callbacks: 0
# https://facebook.com/groups/995898333776940/1027358627297577
new-cap: 0
# equivalent to jshint W058
new-parens: 2
newline-after-var: 0
# equivalent to FacebookWebJSLintLinter's checkPhpStyleArray
no-array-constructor: 2
no-continue: 0
no-inline-comments: 0
# doesn't play well with `if (__DEV__) {}`
no-lonely-if: 0
# stopgap, irrelevant if we can eventually turn `indent` on to error
no-mixed-spaces-and-tabs: 2
# we do this a bunch of places, and it's less bad with proper indentation
no-nested-ternary: 0
# similar to FacebookWebJSLintLinter's checkPhpStyleArray
no-new-object: 1
no-spaced-func: 1
no-ternary: 0
# should be handled by a generic TXT linter instead
no-trailing-spaces: 0
# we use this for private/protected identifiers
no-underscore-dangle: 0
# disallow `var isYes = answer === 1 ? true : false;`
no-unneeded-ternary: 1
# too noisy ATM
object-curly-spacing: 0
# makes indentation warnings clearer
one-var: [1, {initialized: never}]
# prefer `x += 4` over `x = x + 4`
operator-assignment: [1, always]
# equivalent to jshint laxbreak
operator-linebreak: 0
padded-blocks: 0
# probably too noisy on pre-ES5 code
quote-props: [0, as-needed]
quotes: [1, single, {"allowTemplateLiterals": true}]
semi-spacing: [1, {before: false, after: true}]
# equivalent to jshint asi/W032
semi: [1, always]
sort-vars: 0
# require `if () {` instead of `if (){`
space-before-blocks: 2
# require `function foo()` instead of `function foo ()`
space-before-function-paren: [1, {anonymous: never, named: never}]
space-in-parens: [1, never]
space-infix-ops: 0
# Currently broken: https://github.com/eslint/eslint/issues/2764
space-unary-ops: [0, {words: true, nonwords: false}]
# TODO: Figure out a way to do this that doesn't break typechecks
# or wait for https://github.com/eslint/eslint/issues/2897
spaced-comment: [0, always, {exceptions: [jshint, jslint, eslint, global]}]
wrap-regex: 0
# require `return -a` instead of `return-a` and `if ()` instead of `if()`
keyword-spacing: 1
# ECMAScript 6 <http://eslint.org/docs/rules/#ecmascript-6>
# TODO: our style guide says to always use parens, even w/ a single param
arrow-parens: 0
# tbgs finds *very few* places where we don't put spaces around =>
arrow-spacing: [1, {before: true, after: true}]
# violation of the ES6 spec, won't transform
constructor-super: 2
# https://github.com/babel/babel-eslint#known-issues
generator-star-spacing: 0
no-class-assign: 1
# this is a runtime error
no-const-assign: 2
# violation of the ES6 spec, won't transform, `this` is part of the TDZ
no-this-before-super: 2
# we have way too much ES3 & ES5 code
no-var: 0
object-shorthand: 0
# will only impact future ES6 code that'll use let
prefer-const: 1
prefer-spread: 0
# we don't support/polyfill this yet
prefer-reflect: 0
# there are legitimate use-cases for an empty generator
require-yield: 0
# Legacy <http://eslint.org/docs/rules/#legacy>
max-depth: 0
# TODO: replace regexp linter with this, using {ignorePattern}
max-len: 0
max-params: 0
max-statements: 0
no-bitwise: 0
no-plusplus: 0
# JSX
# Our transforms set this automatically
react/display-name: 0
react/jsx-boolean-value: [2, always]
react/jsx-no-undef: 2
# We don't care to do this
react/jsx-sort-prop-types: 0
react/jsx-sort-props: 0
react/jsx-uses-react: 2
react/jsx-uses-vars: 2
# It's easier to test some things this way
react/no-did-mount-set-state: 0
react/no-did-update-set-state: 0
# We define multiple components in test files
react/no-multi-comp: 0
react/no-unknown-property: 2
# This isn't useful in our test code
react/prop-types: 0
# We're using react in global scope (via WebPack vendors.js)
# react/react-in-jsx-scope: 2
react/self-closing-comp: 2
# We don't care to do this
react/sort-comp: 0
react/wrap-multilines: [2, {declaration: false, assignment: false}]