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/best-practices.js
|
5 | rule: https://eslint.org/docs/rules/#best-practices
|
6 | */
|
7 |
|
8 | module.exports = {
|
9 | rules: {
|
10 | // require the use of === and !==
|
11 | // https://eslint.org/docs/rules/eqeqeq
|
12 | eqeqeq: ['error', 'always', {null: 'ignore'}],
|
13 |
|
14 | // disallow use of arguments.caller or arguments.callee
|
15 | 'no-caller': 'error',
|
16 |
|
17 | // disallow lexical declarations in case/default clauses
|
18 | // https://eslint.org/docs/rules/no-case-declarations.html
|
19 | 'no-case-declarations': 'warn',
|
20 |
|
21 | // disallow empty destructuring patterns
|
22 | // https://eslint.org/docs/rules/no-empty-pattern
|
23 | 'no-empty-pattern': 'error',
|
24 |
|
25 | // disallow comparisons to null without a type-checking operator
|
26 | 'no-eq-null': 'off',
|
27 |
|
28 | // disallow use of eval()
|
29 | 'no-eval': 'error',
|
30 |
|
31 | // disallow adding to native types
|
32 | 'no-extend-native': 'warn',
|
33 |
|
34 | // disallow unnecessary function binding
|
35 | 'no-extra-bind': 'warn',
|
36 |
|
37 | // disallow Unnecessary Labels
|
38 | // https://eslint.org/docs/rules/no-extra-label
|
39 | 'no-extra-label': 'warn',
|
40 |
|
41 | // disallow fallthrough of case statements
|
42 | 'no-fallthrough': 'warn',
|
43 |
|
44 | // disallow reassignments of native objects or read-only globals
|
45 | // https://eslint.org/docs/rules/no-global-assign
|
46 | 'no-global-assign': ['warn', {exceptions: []}],
|
47 |
|
48 | // disallow use of eval()-like methods
|
49 | 'no-implied-eval': 'error',
|
50 |
|
51 | // disallow use of labels for anything other then loops and switches
|
52 | 'no-labels': [
|
53 | 'warn',
|
54 | {
|
55 | allowLoop: false,
|
56 | allowSwitch: false,
|
57 | },
|
58 | ],
|
59 |
|
60 | // disallow usage of __iterator__ property
|
61 | 'no-iterator': 'warn',
|
62 |
|
63 | // disallow use of multiline strings
|
64 | 'no-multi-str': 'warn',
|
65 |
|
66 | // disallows creating new instances of String, Number, and Boolean
|
67 | 'no-new-wrappers': 'warn',
|
68 |
|
69 | // disallow use of (old style) octal literals
|
70 | 'no-octal': 'warn',
|
71 |
|
72 | // disallow use of octal escape sequences in string literals, such as
|
73 | // var foo = 'Copyright \251';
|
74 | 'no-octal-escape': 'warn',
|
75 |
|
76 | // disallow usage of __proto__ property
|
77 | 'no-proto': 'warn',
|
78 |
|
79 | // disallow declaring the same variable more then once
|
80 | 'no-redeclare': 'error',
|
81 |
|
82 | // disallow certain object properties
|
83 | // https://eslint.org/docs/rules/no-restricted-properties
|
84 | 'no-restricted-properties': [
|
85 | 'warn',
|
86 | {
|
87 | object: 'arguments',
|
88 | property: 'callee',
|
89 | message: 'arguments.callee is deprecated',
|
90 | },
|
91 | {
|
92 | property: '__defineGetter__',
|
93 | message: 'Please use Object.defineProperty instead.',
|
94 | },
|
95 | {
|
96 | property: '__defineSetter__',
|
97 | message: 'Please use Object.defineProperty instead.',
|
98 | },
|
99 | ],
|
100 |
|
101 | // disallow self assignment
|
102 | // https://eslint.org/docs/rules/no-self-assign
|
103 | 'no-self-assign': [
|
104 | 'warn',
|
105 | {
|
106 | props: false,
|
107 | },
|
108 | ],
|
109 |
|
110 | // disallow comparisons where both sides are exactly the same
|
111 | 'no-self-compare': 'error',
|
112 |
|
113 | // disallow use of comma operator
|
114 | 'no-sequences': 'error',
|
115 |
|
116 | // restrict what can be thrown as an exception
|
117 | 'no-throw-literal': 'warn',
|
118 |
|
119 | // disallow unmodified conditions of loops
|
120 | // https://eslint.org/docs/rules/no-unmodified-loop-condition
|
121 | 'no-unmodified-loop-condition': 'warn',
|
122 |
|
123 | // disallow unused labels
|
124 | // https://eslint.org/docs/rules/no-unused-labels
|
125 | 'no-unused-labels': 'warn',
|
126 |
|
127 | // disallow unnecessary string escaping
|
128 | // https://eslint.org/docs/rules/no-useless-escape
|
129 | 'no-useless-escape': 'warn',
|
130 |
|
131 | // disallow use of void operator
|
132 | // https://eslint.org/docs/rules/no-void
|
133 | 'no-void': 'warn',
|
134 |
|
135 | // disallow use of the with statement
|
136 | 'no-with': 'warn',
|
137 |
|
138 | // require use of the second argument for parseInt()
|
139 | radix: 'warn',
|
140 | },
|
141 | };
|