|
1 | 1 | { |
| 2 | + "root": true, |
2 | 3 | "parser": "babel-eslint", |
3 | 4 | "env": { |
4 | 5 | "browser": true, |
5 | 6 | "node": true, |
6 | 7 | "es6": true, |
7 | | - "mocha": true |
| 8 | + "mocha": true, |
| 9 | + "jest": true |
8 | 10 | }, |
9 | | - "plugins": ["react"], |
| 11 | + "plugins": [ |
| 12 | + "react", |
| 13 | + "mocha" |
| 14 | + ], |
10 | 15 | "extends": [ |
11 | | - "plugin:react/recommended" |
| 16 | + "plugin:react/recommended" |
12 | 17 | ], |
13 | 18 | // eslint > 2.x |
14 | 19 | "parserOptions": { |
|
37 | 42 | "jsx": true |
38 | 43 | } |
39 | 44 | }, |
40 | | - // eslint 1.x |
41 | | - "ecmaFeatures": { |
42 | | - "arrowFunctions": true, |
43 | | - "binaryLiterals": true, |
44 | | - "blockBindings": true, |
45 | | - "classes": true, |
46 | | - "defaultParams": true, |
47 | | - "destructuring": true, |
48 | | - "forOf": true, |
49 | | - "generators": true, |
50 | | - "modules": true, |
51 | | - "objectLiteralComputedProperties": true, |
52 | | - "objectLiteralDuplicateProperties": true, |
53 | | - "objectLiteralShorthandMethods": true, |
54 | | - "objectLiteralShorthandProperties": true, |
55 | | - "octalLiterals": true, |
56 | | - "regexUFlag": true, |
57 | | - "regexYFlag": true, |
58 | | - "spread": true, |
59 | | - "superInFunctions": true, |
60 | | - "templateStrings": true, |
61 | | - "unicodeCodePointEscapes": true, |
62 | | - "globalReturn": true, |
63 | | - "jsx": true |
64 | | - }, |
65 | | - |
| 45 | + // // eslint 1.x (deprecated): |
| 46 | + // "ecmaFeatures": { |
| 47 | + // "arrowFunctions": true, |
| 48 | + // "binaryLiterals": true, |
| 49 | + // "blockBindings": true, |
| 50 | + // "classes": true, |
| 51 | + // "defaultParams": true, |
| 52 | + // "destructuring": true, |
| 53 | + // "forOf": true, |
| 54 | + // "generators": true, |
| 55 | + // "modules": true, |
| 56 | + // "objectLiteralComputedProperties": true, |
| 57 | + // "objectLiteralDuplicateProperties": true, |
| 58 | + // "objectLiteralShorthandMethods": true, |
| 59 | + // "objectLiteralShorthandProperties": true, |
| 60 | + // "octalLiterals": true, |
| 61 | + // "regexUFlag": true, |
| 62 | + // "regexYFlag": true, |
| 63 | + // "spread": true, |
| 64 | + // "superInFunctions": true, |
| 65 | + // "templateStrings": true, |
| 66 | + // "unicodeCodePointEscapes": true, |
| 67 | + // "globalReturn": true, |
| 68 | + // "jsx": true |
| 69 | + // }, |
66 | 70 | "rules": { |
67 | | - |
68 | 71 | // |
69 | 72 | //Possible Errors |
70 | 73 | // |
|
97 | 100 | "use-isnan": 2, // disallow comparisons with the value NaN |
98 | 101 | "valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default) |
99 | 102 | "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string |
100 | | - |
101 | 103 | // |
102 | 104 | // Best Practices |
103 | 105 | // |
104 | 106 | // These are rules designed to prevent you from making mistakes. |
105 | 107 | // They either prescribe a better way of doing something or help you avoid footguns. |
106 | 108 | // |
107 | | - "prefer-const": ["error", { "destructuring": "any", "ignoreReadBeforeAssign": false }], |
108 | 109 | "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863 |
109 | 110 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) |
110 | 111 | "consistent-return": 2, // require return statements to either always or never specify values |
|
148 | 149 | "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default) |
149 | 150 | "no-unused-expressions": 2, // disallow usage of expressions in statement position |
150 | 151 | "no-void": 2, // disallow use of void operator (off by default) |
151 | | - "no-warning-comments": [0, {"terms": ["todo", "fixme"], "location": "start"}], // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default) |
| 152 | + "no-warning-comments": [ |
| 153 | + 0, |
| 154 | + { |
| 155 | + "terms": [ |
| 156 | + "todo", |
| 157 | + "fixme" |
| 158 | + ], |
| 159 | + "location": "start" |
| 160 | + } |
| 161 | + ], // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default) |
152 | 162 | "no-with": 2, // disallow use of the with statement |
153 | 163 | "radix": 2, // require use of the second argument for parseInt() (off by default) |
154 | 164 | "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default) |
155 | 165 | "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default) |
156 | 166 | "yoda": 2, // require or disallow Yoda conditions |
157 | | - |
158 | 167 | // |
159 | 168 | // Strict Mode |
160 | 169 | // |
161 | 170 | // These rules relate to using strict mode. |
162 | 171 | // |
163 | 172 | "strict": 0, // controls location of Use Strict Directives. 0: required by `babel-eslint` |
164 | | - |
165 | 173 | // |
166 | 174 | // Variables |
167 | 175 | // |
|
176 | 184 | "no-undef-init": 2, // disallow use of undefined when initializing variables |
177 | 185 | "no-undefined": 2, // disallow use of undefined variable (off by default) |
178 | 186 | "no-unused-vars": 2, // disallow declaration of variables that are not used in the code |
179 | | - "no-use-before-define": ["error", { "functions": false, "classes": true }], // disallow use of variables before they are defined |
180 | | - |
| 187 | + "no-use-before-define": [ |
| 188 | + "error", |
| 189 | + { |
| 190 | + "functions": false, |
| 191 | + "classes": true |
| 192 | + } |
| 193 | + ], // disallow use of variables before they are defined |
181 | 194 | // |
182 | 195 | //Stylistic Issues |
183 | 196 | // |
184 | 197 | // These rules are purely matters of style and are quite subjective. |
185 | 198 | // |
186 | | - "indent": [1, 2], // this option sets a specific tab width for your code (off by default) |
| 199 | + "indent": [ |
| 200 | + 1, |
| 201 | + 2 |
| 202 | + ], // this option sets a specific tab width for your code (off by default) |
187 | 203 | "brace-style": 1, // enforce one true brace style (off by default) |
188 | 204 | "camelcase": 1, // require camel case names |
189 | | - "comma-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after comma |
190 | | - "comma-style": [1, "last"], // enforce one true comma style (off by default) |
191 | | - "consistent-this": [1, "_this"], // enforces consistent naming when capturing the current execution context (off by default) |
| 205 | + "comma-spacing": [ |
| 206 | + 1, |
| 207 | + { |
| 208 | + "before": false, |
| 209 | + "after": true |
| 210 | + } |
| 211 | + ], // enforce spacing before and after comma |
| 212 | + "comma-style": [ |
| 213 | + 1, |
| 214 | + "last" |
| 215 | + ], // enforce one true comma style (off by default) |
| 216 | + "consistent-this": [ |
| 217 | + 1, |
| 218 | + "_this" |
| 219 | + ], // enforces consistent naming when capturing the current execution context (off by default) |
192 | 220 | "eol-last": 1, // enforce newline at the end of file, with no multiple empty lines |
193 | 221 | "func-names": 0, // require function expressions to have a name (off by default) |
194 | 222 | "func-style": 0, // enforces use of function declarations or expressions (off by default) |
195 | | - |
196 | | - "max-nested-callbacks": [1, 3], // specify the maximum depth callbacks can be nested (off by default) |
197 | | - "new-cap": [1, {"newIsCap": true, "capIsNew": false}], // require a capital letter for constructors |
| 223 | + "max-nested-callbacks": [ |
| 224 | + 1, |
| 225 | + 3 |
| 226 | + ], // specify the maximum depth callbacks can be nested (off by default) |
| 227 | + "new-cap": [ |
| 228 | + 1, |
| 229 | + { |
| 230 | + "newIsCap": true, |
| 231 | + "capIsNew": false |
| 232 | + } |
| 233 | + ], // require a capital letter for constructors |
198 | 234 | "new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments |
199 | 235 | "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) |
200 | 236 | "no-array-constructor": 1, // disallow use of the Array constructor |
201 | 237 | "no-inline-comments": 0, // disallow comments inline after code (off by default) |
202 | 238 | "no-lonely-if": 1, // disallow if as the only statement in an else block (off by default) |
203 | 239 | "no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation |
204 | | - "no-multiple-empty-lines": [1, {"max": 2}], // disallow multiple empty lines (off by default) |
| 240 | + "no-multiple-empty-lines": [ |
| 241 | + 1, |
| 242 | + { |
| 243 | + "max": 2 |
| 244 | + } |
| 245 | + ], // disallow multiple empty lines (off by default) |
205 | 246 | "no-nested-ternary": 1, // disallow nested ternary expressions (off by default) |
206 | 247 | "no-new-object": 1, // disallow use of the Object constructor |
207 | 248 | "no-spaced-func": 1, // disallow space between function identifier and application |
208 | 249 | "no-ternary": 0, // disallow the use of ternary operators (off by default) |
209 | 250 | //"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines |
210 | 251 | //"no-underscore-dangle": 1, // disallow dangling underscores in identifiers |
211 | | - "one-var": [1, "never"], // allow just one var statement per function (off by default) |
212 | | - "operator-assignment": [1, "never"], // require assignment operator shorthand where possible or prohibit it entirely (off by default) |
213 | | - "padded-blocks": [1, "never"], // enforce padding within blocks (off by default) |
214 | | - |
215 | | - "quotes": [1, "single"], // specify whether double or single quotes should be used |
216 | | - "semi": [1, "always"], // require or disallow use of semicolons instead of ASI |
217 | | - "semi-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after semicolons |
| 252 | + "one-var": [ |
| 253 | + 1, |
| 254 | + "never" |
| 255 | + ], // allow just one var statement per function (off by default) |
| 256 | + "operator-assignment": [ |
| 257 | + 1, |
| 258 | + "never" |
| 259 | + ], // require assignment operator shorthand where possible or prohibit it entirely (off by default) |
| 260 | + "padded-blocks": [ |
| 261 | + 1, |
| 262 | + "never" |
| 263 | + ], // enforce padding within blocks (off by default) |
| 264 | + "quotes": [ |
| 265 | + 1, |
| 266 | + "single" |
| 267 | + ], // specify whether double or single quotes should be used |
| 268 | + "semi": [ |
| 269 | + 1, |
| 270 | + "always" |
| 271 | + ], // require or disallow use of semicolons instead of ASI |
| 272 | + "semi-spacing": [ |
| 273 | + 1, |
| 274 | + { |
| 275 | + "before": false, |
| 276 | + "after": true |
| 277 | + } |
| 278 | + ], // enforce spacing before and after semicolons |
218 | 279 | "sort-vars": 0, // sort variables within the same declaration block (off by default) |
219 | 280 | // "space-after-keywords": [1, "always"], // require a space after certain keywords (off by default) |
220 | | - "space-before-blocks": [1, "always"], // require or disallow space before blocks (off by default) |
221 | | - "space-before-function-paren": [1, {"anonymous": "always", "named": "never"}], // require or disallow space before function opening parenthesis (off by default) |
| 281 | + "space-before-blocks": [ |
| 282 | + 1, |
| 283 | + "always" |
| 284 | + ], // require or disallow space before blocks (off by default) |
| 285 | + "space-before-function-paren": [ |
| 286 | + 1, |
| 287 | + { |
| 288 | + "anonymous": "always", |
| 289 | + "named": "never" |
| 290 | + } |
| 291 | + ], // require or disallow space before function opening parenthesis (off by default) |
222 | 292 | //"space-in-brackets": [1, "never"], // require or disallow spaces inside brackets (off by default) |
223 | | - "space-in-parens": [1, "never"], // require or disallow spaces inside parentheses (off by default) |
224 | | - "space-unary-ops": [1, {"words": true, "nonwords": false}], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) |
225 | | - "spaced-comment": [1, "always"], // require or disallow a space immediately following the // in a line comment (off by default) |
| 293 | + "space-in-parens": [ |
| 294 | + 1, |
| 295 | + "never" |
| 296 | + ], // require or disallow spaces inside parentheses (off by default) |
| 297 | + "space-unary-ops": [ |
| 298 | + 1, |
| 299 | + { |
| 300 | + "words": true, |
| 301 | + "nonwords": false |
| 302 | + } |
| 303 | + ], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) |
| 304 | + "spaced-comment": [ |
| 305 | + 1, |
| 306 | + "always" |
| 307 | + ], // require or disallow a space immediately following the // in a line comment (off by default) |
226 | 308 | "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) |
227 | | - |
228 | 309 | // |
229 | 310 | // ECMAScript 6 |
230 | 311 | // |
231 | 312 | // These rules are only relevant to ES6 environments and are off by default. |
232 | 313 | // |
233 | 314 | "no-var": 2, // require let or const instead of var (off by default) |
234 | | - "generator-star-spacing": [2, "before"], // enforce the spacing around the * in generator functions (off by default) |
235 | | - |
| 315 | + "generator-star-spacing": [ |
| 316 | + 2, |
| 317 | + "before" |
| 318 | + ], // enforce the spacing around the * in generator functions (off by default) |
236 | 319 | // |
237 | 320 | // Legacy |
238 | 321 | // |
239 | 322 | // The following rules are included for compatibility with JSHint and JSLint. |
240 | 323 | // While the names of the rules may not match up with the JSHint/JSLint counterpart, |
241 | 324 | // the functionality is the same. |
242 | 325 | // |
243 | | - "max-depth": [2, 3], // specify the maximum depth that blocks can be nested (off by default) |
244 | | - "max-len": [2, 300, 2], // specify the maximum length of a line in your program (off by default) |
245 | | - "max-params": [2, 5], // limits the number of parameters that can be used in the function declaration. (off by default) |
| 326 | + "max-depth": [ |
| 327 | + 2, |
| 328 | + 3 |
| 329 | + ], // specify the maximum depth that blocks can be nested (off by default) |
| 330 | + "max-len": [ |
| 331 | + 2, |
| 332 | + 300, |
| 333 | + 2 |
| 334 | + ], // specify the maximum length of a line in your program (off by default) |
| 335 | + "max-params": [ |
| 336 | + 2, |
| 337 | + 5 |
| 338 | + ], // limits the number of parameters that can be used in the function declaration. (off by default) |
246 | 339 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) |
247 | 340 | "no-bitwise": 0, // disallow use of bitwise operators (off by default) |
248 | 341 | "no-plusplus": 2, // disallow use of unary operators, ++ and -- (off by default) |
249 | | - |
250 | 342 | // |
251 | 343 | // eslint-plugin-react |
252 | 344 | // |
253 | 345 | // React specific linting rules for ESLint |
254 | 346 | // |
255 | 347 | "react/display-name": 0, // Prevent missing displayName in a React component definition |
256 | 348 | //"react/jsx-quotes": [2, "double", "avoid-escape"], // Enforce quote style for JSX attributes |
257 | | - "jsx-quotes": [ |
258 | | - 2, "prefer-double" |
259 | | - ], |
| 349 | + "jsx-quotes": [ |
| 350 | + 2, |
| 351 | + "prefer-double" |
| 352 | + ], |
260 | 353 | // "react/jsx-quotes": 0, |
261 | 354 | "react/jsx-no-undef": 2, // Disallow undeclared variables in JSX |
262 | 355 | "react/jsx-sort-props": 0, // Enforce props alphabetical sorting |
263 | 356 | "react/jsx-uses-react": 2, // Prevent React to be incorrectly marked as unused |
264 | 357 | "react/jsx-uses-vars": 2, // Prevent variables used in JSX to be incorrectly marked as unused |
265 | | - // "react/no-did-mount-set-state": [2, "allow-in-func"], // Prevent usage of setState in componentDidMount |
266 | | - // "react/no-did-update-set-state": 2, // Prevent usage of setState in componentDidUpdate |
| 358 | + "react/no-did-mount-set-state": 2, // Prevent usage of setState in componentDidMount |
| 359 | + "react/no-did-update-set-state": 2, // Prevent usage of setState in componentDidUpdate |
267 | 360 | "react/no-multi-comp": 0, // Prevent multiple component definition per file |
268 | 361 | "react/no-unknown-property": 2, // Prevent usage of unknown DOM property |
269 | 362 | "react/prop-types": 2, // Prevent missing props validation in a React component definition |
|
0 commit comments