1 | /*
|
2 | override airbnb
|
3 | repo: https://github.com/airbnb/javascript
|
4 | code: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/errors.js
|
5 | rule: https://eslint.org/docs/rules/#possible-errors
|
6 | */
|
7 |
|
8 | module.exports = {
|
9 | rules: {
|
10 | // Enforce “for” loop update clause moving the counter in the right direction
|
11 | // https://eslint.org/docs/rules/for-direction
|
12 | 'for-direction': 'warn',
|
13 |
|
14 | // Enforces that a return statement is present in property getters
|
15 | // https://eslint.org/docs/rules/getter-return
|
16 | 'getter-return': ['warn', {allowImplicit: true}],
|
17 |
|
18 | // Disallow comparisons to negative zero
|
19 | // https://eslint.org/docs/rules/no-compare-neg-zero
|
20 | 'no-compare-neg-zero': 'warn',
|
21 |
|
22 | // disallow use of constant expressions in conditions
|
23 | 'no-constant-condition': ['warn', {checkLoops: false}],
|
24 |
|
25 | // disallow duplicate arguments in functions
|
26 | 'no-dupe-args': 'error',
|
27 |
|
28 | // disallow duplicate conditions in if-else-if chains
|
29 | 'no-dupe-else-if': 'error',
|
30 |
|
31 | // disallow duplicate keys when creating object literals
|
32 | 'no-dupe-keys': 'error',
|
33 |
|
34 | // disallow a duplicate case label.
|
35 | 'no-duplicate-case': 'warn',
|
36 |
|
37 | // disallow empty statements
|
38 | 'no-empty': [
|
39 | 'warn',
|
40 | {
|
41 | allowEmptyCatch: true,
|
42 | },
|
43 | ],
|
44 |
|
45 | // disallow the use of empty character classes in regular expressions
|
46 | 'no-empty-character-class': 'warn',
|
47 |
|
48 | // disallow assigning to the exception in a catch block
|
49 | 'no-ex-assign': 'warn',
|
50 |
|
51 | // disallow double-negation boolean casts in a boolean context
|
52 | // https://eslint.org/docs/rules/no-extra-boolean-cast
|
53 | 'no-extra-boolean-cast': 'warn',
|
54 |
|
55 | // disallow overwriting functions written as function declarations
|
56 | 'no-func-assign': 'error',
|
57 |
|
58 | // disallow assigning to imported bindings
|
59 | 'no-import-assign': 'error',
|
60 |
|
61 | // disallow function or variable declarations in nested blocks
|
62 | 'no-inner-declarations': 'warn',
|
63 |
|
64 | // disallow invalid regular expression strings in the RegExp constructor
|
65 | 'no-invalid-regexp': 'warn',
|
66 |
|
67 | // disallow irregular whitespace outside of strings and comments
|
68 | 'no-irregular-whitespace': 'error',
|
69 |
|
70 | // disallow the use of object properties of the global object (Math and JSON) as functions
|
71 | 'no-obj-calls': 'error',
|
72 |
|
73 | // disallow multiple spaces in a regular expression literal
|
74 | 'no-regex-spaces': 'warn',
|
75 |
|
76 | // disallow sparse arrays
|
77 | 'no-sparse-arrays': 'warn',
|
78 |
|
79 | // disallow returning values from setters
|
80 | 'no-setter-return': 'error',
|
81 |
|
82 | // Avoid code that looks like two expressions but is actually one
|
83 | // https://eslint.org/docs/rules/no-unexpected-multiline
|
84 | 'no-unexpected-multiline': 'warn',
|
85 |
|
86 | // disallow unreachable statements after a return, throw, continue, or break statement
|
87 | 'no-unreachable': 'warn',
|
88 |
|
89 | // disallow return/throw/break/continue inside finally blocks
|
90 | // https://eslint.org/docs/rules/no-unsafe-finally
|
91 | 'no-unsafe-finally': 'warn',
|
92 |
|
93 | // disallow negating the left operand of relational operators
|
94 | // https://eslint.org/docs/rules/no-unsafe-negation
|
95 | 'no-unsafe-negation': 'warn',
|
96 |
|
97 | // disallow comparisons with the value NaN
|
98 | 'use-isnan': 'error',
|
99 |
|
100 | // ensure that the results of typeof are compared against a valid string
|
101 | // https://eslint.org/docs/rules/valid-typeof
|
102 | 'valid-typeof': 'warn',
|
103 | },
|
104 | };
|