-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
216 lines (205 loc) · 15.3 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
{
"parser": "babel-eslint",
"env": {
"browser": true,
"jest": true,
},
"plugins": [
"react"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"globals": {
"__DEV__": true,
"__dirname": false,
"__fbBatchedBridgeConfig": false,
"alert": false,
"cancelAnimationFrame": false,
"cancelIdleCallback": false,
"clearImmediate": true,
"clearInterval": false,
"clearTimeout": false,
"console": false,
"document": false,
"escape": false,
"Event": false,
"EventTarget": false,
"exports": false,
"fetch": true,
"FormData": false,
"global": false,
"Map": true,
"module": false,
"navigator": false,
"process": false,
"Promise": true,
"requestAnimationFrame": true,
"requestIdleCallback": true,
"require": false,
"Set": true,
"setImmediate": true,
"setInterval": false,
"setTimeout": false,
"window": false,
"XMLHttpRequest": false,
"pit": false
},
"rules": {
"indent": ["error", 4], // disallow trailing commas in object literals
"comma-dangle": ["error", "always-multiline"], // disallow trailing commas in object literals
"no-cond-assign":["error"], // disallow assignment in conditional expressions
"no-console":["error"], // disallow use of console (off by default in the node environment)
"no-constant-condition":["off"], // disallow use of constant expressions in conditions
"no-control-regex":["error"], // disallow control characters in regular expressions
"no-debugger":["error"], // disallow use of debugger
"no-dupe-keys":["error"], // disallow duplicate keys when creating object literals
"no-empty":["off"], // disallow empty statements
"no-ex-assign":["error"], // disallow assigning to the exception in a catch block
"no-extra-boolean-cast":["error"], // disallow double-negation boolean casts in a boolean context
"no-extra-parens":["off"], // disallow unnecessary parentheses (off by default)
"no-extra-semi":["error"], // disallow unnecessary semicolons
"no-func-assign":["error"], // disallow overwriting functions written as function declarations
"no-inner-declarations":["off"], // disallow function or variable declarations in nested blocks
"no-invalid-regexp":["error"], // disallow invalid regular expression strings in the RegExp constructor
"no-negated-in-lhs":["error"], // disallow negation of the left operand of an in expression
"no-obj-calls":["error"], // disallow the use of object properties of the global object (Math and JSON) as functions
"no-regex-spaces":["error"], // disallow multiple spaces in a regular expression literal
"no-reserved-keys":["off"], // disallow reserved words being used as object literal keys (off by default)
"no-sparse-arrays":["error"], // disallow sparse arrays
"no-unreachable":["error"], // disallow unreachable statements after a return, throw, continue, or break statement
"use-isnan":["error"], // disallow comparisons with the value NaN
"valid-jsdoc":["off"], // Ensure JSDoc comments are valid (off by default)
"valid-typeof":["error"], // Ensure that the results of typeof are compared against a valid string
"object-curly-spacing": ["error", "always"], // Enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers
// Best Practices
// These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns.
"block-scoped-var":["off"], // treat var statements as if they were block scoped (off by default)
"complexity":["off"], // specify the maximum cyclomatic complexity allowed in a program (off by default)
"consistent-return":["off"], // require return statements to either always or never specify values
"curly":["error"], // specify curly brace conventions for all control statements
"default-case":["off"], // require default case in switch statements (off by default)
"dot-notation":["error"], // encourages use of dot notation whenever possible
"eqeqeq": ["error", "allow-null"], // require the use of === and !==
"guard-for-in":["off"], // make sure for-in loops have an if statement (off by default)
"no-alert":["error"], // disallow the use of alert, confirm, and prompt
"no-caller":["error"], // disallow use of arguments.caller or arguments.callee
"no-div-regex":["error"], // disallow division operators explicitly at beginning of regular expression (off by default)
"no-else-return":["off"], // disallow else after a return in an if (off by default)
"no-eq-null":["off"], // disallow comparisons to null without a type-checking operator (off by default)
"no-eval":["error"], // disallow use of eval()
"no-extend-native":["error"], // disallow adding to native types
"no-extra-bind":["error"], // disallow unnecessary function binding
"no-fallthrough":["error"], // disallow fallthrough of case statements
"no-floating-decimal":["error"], // disallow the use of leading or trailing decimal points in numeric literals (off by default)
"no-implied-eval":["error"], // disallow use of eval()-like methods
"no-labels":["error"], // disallow use of labeled statements
"no-iterator":["error"], // disallow usage of __iterator__ property
"no-lone-blocks":["error"], // disallow unnecessary nested blocks
"no-loop-func":["off"], // disallow creation of functions within loops
"no-multi-str":["off"], // disallow use of multiline strings
"no-multiple-empty-lines": ["error", {"max": 2, "maxEOF": 0 }], // disallow multiple empty lines
"no-native-reassign":["off"], // disallow reassignments of native objects
"no-new":["error"], // disallow use of new operator when not part of the assignment or comparison
"no-new-func":["error"], // disallow use of new operator for Function object
"no-new-wrappers":["error"], // disallows creating new instances of String,Number, and Boolean
"no-octal":["error"], // disallow use of octal literals
"no-octal-escape":["error"], // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \"error"51";
"no-proto":["error"], // disallow usage of __proto__ property
"no-redeclare":["off"], // disallow declaring the same variable more then once
"no-return-assign":["error"], // disallow use of assignment in return statement
"no-script-url":["error"], // disallow use of javascript: urls.
"no-self-compare":["error"], // disallow comparisons where both sides are exactly the same (off by default)
"no-sequences":["error"], // disallow use of comma operator
"no-unused-expressions":["off"], // disallow usage of expressions in statement position
"no-void":["error"], // disallow use of void operator (off by default)
"no-warning-comments":["off"], // disallow usage of configurable warning terms in comments":[1], // e.g. TODO or FIXME (off by default)
"no-with":["error"], // disallow use of the with statement
"radix":["error"], // require use of the second argument for parseInt() (off by default)
"semi-spacing":["error"], // require a space after a semi-colon
"vars-on-top":["off"], // requires to declare all vars on top of their containing scope (off by default)
"wrap-iife":["off"], // require immediate function invocation to be wrapped in parentheses (off by default)
"yoda":["error"], // require or disallow Yoda conditions
// Variables
// These rules have to do with variable declarations.
"no-catch-shadow":["error"], // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
"no-delete-var":["error"], // disallow deletion of variables
"no-label-var":["error"], // disallow labels that share a name with a variable
"no-shadow":["error"], // disallow declaration of variables already declared in the outer scope
"no-shadow-restricted-names":["error"], // disallow shadowing of names such as arguments
"no-undef":["error"], // disallow use of undeclared variables unless mentioned in a /*global */ block
"no-undefined":["off"], // disallow use of undefined variable (off by default)
"no-undef-init":["error"], // disallow use of undefined when initializing variables
"no-unused-vars": ["error", {"vars": "all", "args": "after-used"}], // disallow declaration of variables that are not used in the code
"no-use-before-define":["off"], // disallow use of variables before they are defined
// Node.js
// These rules are specific to JavaScript running on Node.js.
"handle-callback-err":["error"], // enforces error handling in callbacks (off by default) (on by default in the node environment)
"no-mixed-requires":["error"], // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment)
"no-new-require":["error"], // disallow use of new operator with the require function (off by default) (on by default in the node environment)
"no-path-concat":["error"], // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment)
"no-process-exit":["off"], // disallow process.exit() (on by default in the node environment)
"no-restricted-modules":["error"], // restrict usage of specified node modules (off by default)
"no-sync":["off"], // disallow use of synchronous methods (off by default)
// Stylistic Issues
// These rules are purely matters of style and are quite subjective.
"key-spacing":["off"],
"keyword-spacing":["error"], // enforce spacing before and after keywords
"jsx-quotes": ["error", "prefer-single"],
"comma-spacing":["off"],
"no-multi-spaces":["off"],
"brace-style":["off"], // enforce one true brace style (off by default)
"camelcase":["off"], // require camel case names
"consistent-this": ["error", "self"], // enforces consistent naming when capturing the current execution context (off by default)
"eol-last":["error"], // enforce newline at the end of file, with no multiple empty lines
"func-names":["off"], // require function expressions to have a name (off by default)
"func-style":["off"], // enforces use of function declarations or expressions (off by default)
"new-cap":["off"], // require a capital letter for constructors
"new-parens":["error"], // disallow the omission of parentheses when invoking a constructor with no arguments
"no-nested-ternary":["off"], // disallow nested ternary expressions (off by default)
"no-array-constructor":["error"], // disallow use of the Array constructor
"no-lonely-if":["off"], // disallow if as the only statement in an else block (off by default)
"no-new-object":["error"], // disallow use of the Object constructor
"no-spaced-func":["error"], // disallow space between function identifier and application
"no-ternary":["off"], // disallow the use of ternary operators (off by default)
"no-trailing-spaces":["error"], // disallow trailing whitespace at the end of lines
"no-underscore-dangle":["off"], // disallow dangling underscores in identifiers
"no-mixed-spaces-and-tabs":["error"], // disallow mixed spaces and tabs for indentation
"quotes": ["error", "backtick"], // specify whether double or single quotes should be used
"quote-props":["off"], // require quotes around object literal property names (off by default)
"semi":["error"], // require or disallow use of semicolons instead of ASI
"sort-vars":["off"], // sort variables within the same declaration block (off by default)
"space-in-brackets":["off"], // require or disallow spaces inside brackets (off by default)
"space-in-parens":["off"], // require or disallow spaces inside parentheses (off by default)
"space-infix-ops":["error"], // require spaces around operators
"space-unary-ops": ["error", { "words": true, "nonwords": false }], // require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"max-nested-callbacks":["off"], // specify the maximum depth callbacks can be nested (off by default)
"one-var":["off"], // allow just one var statement per function (off by default)
"wrap-regex":["off"], // require regex literals to be wrapped in parentheses (off by default)
// React Plugin
// The following rules are made available via `eslint-plugin-react`.
"react/display-name":["error"],
"react/jsx-boolean-value":["off"],
"react/jsx-no-duplicate-props":["error"],
"react/jsx-no-undef":["error"],
"react/jsx-sort-props":["off"],
"react/jsx-uses-react":["error"],
"react/jsx-uses-vars":["error"],
"react/jsx-curly-brace-presence":["error", { "props": "always" }],
"react/no-did-mount-set-state":["off"],
"react/no-did-update-set-state":["error"],
"react/no-multi-comp":["off"],
"react/no-string-refs":["error"],
"react/no-unknown-property":["off"],
"react/prop-types":["off"],
"react/react-in-jsx-scope":["error"],
"react/self-closing-comp":["error"],
"react/wrap-multilines":["off"],
}
}