@wistia/oxlint-config 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -9
- package/rules/base.mjs +173 -144
- package/rules/import.mjs +27 -18
- package/rules/node.mjs +4 -4
- package/rules/promise.mjs +16 -16
- package/rules/react-a11y.mjs +31 -31
- package/rules/react.mjs +51 -51
- package/rules/typescript.mjs +104 -100
- package/rules/vitest.mjs +63 -63
package/rules/base.mjs
CHANGED
|
@@ -1,188 +1,198 @@
|
|
|
1
|
+
import confusingBrowserGlobals from 'confusing-browser-globals';
|
|
2
|
+
|
|
1
3
|
export const baseRules = {
|
|
2
4
|
plugins: ['eslint', 'oxc'],
|
|
3
5
|
rules: {
|
|
4
6
|
// Enforce return statements in callbacks of array methods
|
|
5
|
-
// https://
|
|
7
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/array-callback-return.html
|
|
6
8
|
'eslint/array-callback-return': ['error', { allowImplicit: true }],
|
|
7
9
|
|
|
8
10
|
// Require super() calls in constructors
|
|
9
|
-
// https://
|
|
11
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/constructor-super.html
|
|
10
12
|
'eslint/constructor-super': 'error',
|
|
11
13
|
|
|
12
14
|
// Enforce for loop update clause moving the counter in the right direction
|
|
13
|
-
// https://
|
|
15
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/for-direction.html
|
|
14
16
|
'eslint/for-direction': 'error',
|
|
15
17
|
|
|
18
|
+
// Enforce return statements in getters
|
|
19
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/getter-return.html
|
|
20
|
+
'eslint/getter-return': ['error', { allowImplicit: true }],
|
|
21
|
+
|
|
16
22
|
// Disallow using an async function as a Promise executor
|
|
17
|
-
// https://
|
|
23
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-async-promise-executor.html
|
|
18
24
|
'eslint/no-async-promise-executor': 'error',
|
|
19
25
|
|
|
20
26
|
// Disallow await inside of loops
|
|
21
|
-
// https://
|
|
27
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-await-in-loop.html
|
|
22
28
|
'eslint/no-await-in-loop': 'error',
|
|
23
29
|
|
|
24
30
|
// Disallow reassigning class members
|
|
25
|
-
// https://
|
|
31
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-class-assign.html
|
|
26
32
|
'eslint/no-class-assign': 'error',
|
|
27
33
|
|
|
28
34
|
// Disallow comparing against -0
|
|
29
|
-
// https://
|
|
35
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-compare-neg-zero.html
|
|
30
36
|
'eslint/no-compare-neg-zero': 'error',
|
|
31
37
|
|
|
32
38
|
// Disallow assignment operators in conditional expressions
|
|
33
|
-
// https://
|
|
39
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-cond-assign.html
|
|
34
40
|
'eslint/no-cond-assign': ['error', 'always'],
|
|
35
41
|
|
|
36
42
|
// Disallow reassigning const variables
|
|
37
|
-
// https://
|
|
43
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-const-assign.html
|
|
38
44
|
'eslint/no-const-assign': 'error',
|
|
39
45
|
|
|
40
46
|
// Disallow expressions where the operation doesn't affect the value
|
|
41
|
-
// https://
|
|
47
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-constant-binary-expression.html
|
|
42
48
|
'eslint/no-constant-binary-expression': 'error',
|
|
43
49
|
|
|
44
50
|
// Disallow constant expressions in conditions
|
|
45
|
-
// https://
|
|
51
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-constant-condition.html
|
|
46
52
|
'eslint/no-constant-condition': 'error',
|
|
47
53
|
|
|
48
54
|
// Disallow returning value from constructor
|
|
49
|
-
// https://
|
|
55
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-constructor-return.html
|
|
50
56
|
'eslint/no-constructor-return': 'error',
|
|
51
57
|
|
|
52
58
|
// Disallow control characters in regular expressions
|
|
53
|
-
// https://
|
|
59
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-control-regex.html
|
|
54
60
|
'eslint/no-control-regex': 'error',
|
|
55
61
|
|
|
56
62
|
// Disallow the use of debugger
|
|
57
|
-
// https://
|
|
63
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html
|
|
58
64
|
'eslint/no-debugger': 'error',
|
|
59
65
|
|
|
60
66
|
// Disallow duplicate class members
|
|
61
|
-
// https://
|
|
67
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-dupe-class-members.html
|
|
62
68
|
'eslint/no-dupe-class-members': 'error',
|
|
63
69
|
|
|
64
70
|
// Disallow duplicate conditions in if-else-if chains
|
|
65
|
-
// https://
|
|
71
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-dupe-else-if.html
|
|
66
72
|
'eslint/no-dupe-else-if': 'error',
|
|
67
73
|
|
|
68
74
|
// Disallow duplicate keys in object literals
|
|
69
|
-
// https://
|
|
75
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-dupe-keys.html
|
|
70
76
|
'eslint/no-dupe-keys': 'error',
|
|
71
77
|
|
|
72
78
|
// Disallow duplicate case labels
|
|
73
|
-
// https://
|
|
79
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-duplicate-case.html
|
|
74
80
|
'eslint/no-duplicate-case': 'error',
|
|
75
81
|
|
|
76
82
|
// Disallow empty character classes in regular expressions
|
|
77
|
-
// https://
|
|
83
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty-character-class.html
|
|
78
84
|
'eslint/no-empty-character-class': 'error',
|
|
79
85
|
|
|
80
86
|
// Disallow empty destructuring patterns
|
|
81
|
-
// https://
|
|
87
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty-pattern.html
|
|
82
88
|
'eslint/no-empty-pattern': 'error',
|
|
83
89
|
|
|
84
90
|
// Disallow reassigning exceptions in catch clauses
|
|
85
|
-
// https://
|
|
91
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-ex-assign.html
|
|
86
92
|
'eslint/no-ex-assign': 'error',
|
|
87
93
|
|
|
88
94
|
// Disallow fallthrough of case statements
|
|
89
|
-
// https://
|
|
95
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-fallthrough.html
|
|
90
96
|
'eslint/no-fallthrough': 'error',
|
|
91
97
|
|
|
92
98
|
// Disallow reassigning function declarations
|
|
93
|
-
// https://
|
|
99
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-func-assign.html
|
|
94
100
|
'eslint/no-func-assign': 'error',
|
|
95
101
|
|
|
96
102
|
// Disallow assigning to imported bindings
|
|
97
|
-
// https://
|
|
103
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-import-assign.html
|
|
98
104
|
'eslint/no-import-assign': 'error',
|
|
99
105
|
|
|
100
106
|
// Disallow variable or function declarations in nested blocks
|
|
101
|
-
// https://
|
|
107
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-inner-declarations.html
|
|
102
108
|
'eslint/no-inner-declarations': 'error',
|
|
103
109
|
|
|
104
110
|
// Disallow invalid regular expression strings in RegExp constructors
|
|
105
|
-
// https://
|
|
111
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-invalid-regexp.html
|
|
106
112
|
'eslint/no-invalid-regexp': 'error',
|
|
107
113
|
|
|
108
114
|
// Disallow irregular whitespace
|
|
109
|
-
// https://
|
|
115
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-irregular-whitespace.html
|
|
110
116
|
'eslint/no-irregular-whitespace': 'error',
|
|
111
117
|
|
|
112
118
|
// Disallow literal numbers that lose precision
|
|
113
|
-
// https://
|
|
119
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-loss-of-precision.html
|
|
114
120
|
'eslint/no-loss-of-precision': 'error',
|
|
115
121
|
|
|
116
122
|
// Disallow characters which are made with multiple code points in character class syntax
|
|
117
|
-
// https://
|
|
123
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-misleading-character-class.html
|
|
118
124
|
'eslint/no-misleading-character-class': 'error',
|
|
119
125
|
|
|
120
126
|
// Disallow new operators with global non-constructor functions
|
|
121
|
-
// https://
|
|
127
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-new-native-nonconstructor.html
|
|
122
128
|
'eslint/no-new-native-nonconstructor': 'error',
|
|
123
129
|
|
|
124
130
|
// Disallow calling global object properties as functions
|
|
125
|
-
// https://
|
|
131
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-obj-calls.html
|
|
126
132
|
'eslint/no-obj-calls': 'error',
|
|
127
133
|
|
|
128
134
|
// Disallow returning values from Promise executor functions
|
|
129
|
-
// https://
|
|
135
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-promise-executor-return.html
|
|
130
136
|
'eslint/no-promise-executor-return': 'error',
|
|
131
137
|
|
|
132
138
|
// Disallow calling some Object.prototype methods directly on objects
|
|
133
|
-
// https://
|
|
139
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-prototype-builtins.html
|
|
134
140
|
'eslint/no-prototype-builtins': 'error',
|
|
135
141
|
|
|
136
142
|
// Disallow assignments where both sides are exactly the same
|
|
137
|
-
// https://
|
|
143
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-self-assign.html
|
|
138
144
|
'eslint/no-self-assign': 'error',
|
|
139
145
|
|
|
140
146
|
// Disallow comparisons where both sides are exactly the same
|
|
141
|
-
// https://
|
|
147
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-self-compare.html
|
|
142
148
|
'eslint/no-self-compare': 'error',
|
|
143
149
|
|
|
144
150
|
// Disallow returning values from setters
|
|
145
|
-
// https://
|
|
151
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-setter-return.html
|
|
146
152
|
'eslint/no-setter-return': 'error',
|
|
147
153
|
|
|
148
154
|
// Disallow sparse arrays
|
|
149
|
-
// https://
|
|
155
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-sparse-arrays.html
|
|
150
156
|
'eslint/no-sparse-arrays': 'error',
|
|
151
157
|
|
|
152
158
|
// Disallow template literal placeholder syntax in regular strings
|
|
153
|
-
// https://
|
|
159
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-template-curly-in-string.html
|
|
154
160
|
'eslint/no-template-curly-in-string': 'error',
|
|
155
161
|
|
|
156
162
|
// Disallow this/super before calling super() in constructors
|
|
157
|
-
// https://
|
|
163
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-this-before-super.html
|
|
158
164
|
'eslint/no-this-before-super': 'error',
|
|
159
165
|
|
|
160
166
|
// Disallow let or var variables that are read but never assigned
|
|
161
|
-
// https://
|
|
167
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unassigned-vars.html
|
|
162
168
|
'eslint/no-unassigned-vars': 'error',
|
|
163
169
|
|
|
164
170
|
// Disallow unmodified loop conditions
|
|
165
|
-
// https://
|
|
171
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unmodified-loop-condition.html
|
|
166
172
|
'eslint/no-unmodified-loop-condition': 'error',
|
|
167
173
|
|
|
174
|
+
// Disallow unreachable code after return, throw, continue, and break statements
|
|
175
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unreachable.html
|
|
176
|
+
'eslint/no-unreachable': 'error',
|
|
177
|
+
|
|
168
178
|
// Disallow control flow statements in finally blocks
|
|
169
|
-
// https://
|
|
179
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unsafe-finally.html
|
|
170
180
|
'eslint/no-unsafe-finally': 'error',
|
|
171
181
|
|
|
172
182
|
// Disallow negating the left operand of relational operators
|
|
173
|
-
// https://
|
|
183
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unsafe-negation.html
|
|
174
184
|
'eslint/no-unsafe-negation': 'error',
|
|
175
185
|
|
|
176
186
|
// Disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
177
|
-
// https://
|
|
187
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unsafe-optional-chaining.html
|
|
178
188
|
'eslint/no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
|
|
179
189
|
|
|
180
190
|
// Disallow unused private class members
|
|
181
|
-
// https://
|
|
191
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-private-class-members.html
|
|
182
192
|
'eslint/no-unused-private-class-members': 'error',
|
|
183
193
|
|
|
184
194
|
// Disallow unused variables
|
|
185
|
-
// https://
|
|
195
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-vars.html
|
|
186
196
|
'eslint/no-unused-vars': [
|
|
187
197
|
'error',
|
|
188
198
|
{
|
|
@@ -198,71 +208,71 @@ export const baseRules = {
|
|
|
198
208
|
],
|
|
199
209
|
|
|
200
210
|
// Disallow the use of variables before they are defined
|
|
201
|
-
// https://
|
|
211
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-use-before-define.html
|
|
202
212
|
'eslint/no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
|
|
203
213
|
|
|
204
214
|
// Disallow useless backreferences in regular expressions
|
|
205
|
-
// https://
|
|
215
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-backreference.html
|
|
206
216
|
'eslint/no-useless-backreference': 'error',
|
|
207
217
|
|
|
208
218
|
// Require calls to isNaN() when checking for NaN
|
|
209
|
-
// https://
|
|
219
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/use-isnan.html
|
|
210
220
|
'eslint/use-isnan': 'error',
|
|
211
221
|
|
|
212
222
|
// Enforce comparing typeof expressions against valid strings
|
|
213
|
-
// https://
|
|
223
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/valid-typeof.html
|
|
214
224
|
'eslint/valid-typeof': ['error', { requireStringLiterals: true }],
|
|
215
225
|
|
|
216
226
|
// Enforce getter and setter pairs in objects and classes
|
|
217
|
-
// https://
|
|
227
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/accessor-pairs.html
|
|
218
228
|
'eslint/accessor-pairs': 'error',
|
|
219
229
|
|
|
220
230
|
// Require braces around arrow function bodies
|
|
221
|
-
// https://
|
|
231
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/arrow-body-style.html
|
|
222
232
|
'eslint/arrow-body-style': 'off',
|
|
223
233
|
|
|
224
234
|
// Enforce the use of variables within the scope they are defined
|
|
225
|
-
// https://
|
|
235
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/block-scoped-var.html
|
|
226
236
|
'eslint/block-scoped-var': 'error',
|
|
227
237
|
|
|
228
238
|
// Enforce that class methods utilize this
|
|
229
|
-
// https://
|
|
239
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/class-methods-use-this.html
|
|
230
240
|
'eslint/class-methods-use-this': 'error',
|
|
231
241
|
|
|
232
242
|
// Require default cases in switch statements
|
|
233
|
-
// https://
|
|
243
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/default-case.html
|
|
234
244
|
'eslint/default-case': ['error', { commentPattern: '^no default$' }],
|
|
235
245
|
|
|
236
246
|
// Enforce default clauses in switch statements to be last
|
|
237
|
-
// https://
|
|
247
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/default-case-last.html
|
|
238
248
|
'eslint/default-case-last': 'error',
|
|
239
249
|
|
|
240
250
|
// Enforce default parameters to be last
|
|
241
|
-
// https://
|
|
251
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/default-param-last.html
|
|
242
252
|
'eslint/default-param-last': 'error',
|
|
243
253
|
|
|
244
254
|
// Require the use of === and !==
|
|
245
|
-
// https://
|
|
255
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/eqeqeq.html
|
|
246
256
|
'eslint/eqeqeq': ['error', 'always', { null: 'ignore' }],
|
|
247
257
|
|
|
248
258
|
// Require for-in loops to include an if statement
|
|
249
|
-
// https://
|
|
259
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/guard-for-in.html
|
|
250
260
|
'eslint/guard-for-in': 'error',
|
|
251
261
|
|
|
252
262
|
// Require or disallow named function expressions
|
|
253
|
-
// https://
|
|
263
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/func-names.html
|
|
254
264
|
'eslint/func-names': ['error', 'always'],
|
|
255
265
|
|
|
256
266
|
// Enforce the consistent use of either function declarations or expressions
|
|
257
|
-
// https://
|
|
267
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/func-style.html
|
|
258
268
|
'eslint/func-style': ['error', 'expression'],
|
|
259
269
|
|
|
260
270
|
// Enforce grouped accessor pairs in object literals and classes
|
|
261
|
-
// https://
|
|
271
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/grouped-accessor-pairs.html
|
|
262
272
|
'eslint/grouped-accessor-pairs': 'error',
|
|
263
273
|
|
|
264
274
|
// Enforce minimum and maximum identifier lengths
|
|
265
|
-
// https://
|
|
275
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/id-length.html
|
|
266
276
|
'eslint/id-length': [
|
|
267
277
|
'error',
|
|
268
278
|
{
|
|
@@ -272,11 +282,11 @@ export const baseRules = {
|
|
|
272
282
|
],
|
|
273
283
|
|
|
274
284
|
// Enforce a maximum number of classes per file
|
|
275
|
-
// https://
|
|
285
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-classes-per-file.html
|
|
276
286
|
'eslint/max-classes-per-file': ['error', 1],
|
|
277
287
|
|
|
278
288
|
// Require constructor names to begin with a capital letter
|
|
279
|
-
// https://
|
|
289
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/new-cap.html
|
|
280
290
|
'eslint/new-cap': [
|
|
281
291
|
'error',
|
|
282
292
|
{
|
|
@@ -288,144 +298,144 @@ export const baseRules = {
|
|
|
288
298
|
],
|
|
289
299
|
|
|
290
300
|
// Disallow the use of alert, confirm, and prompt
|
|
291
|
-
// https://
|
|
301
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-alert.html
|
|
292
302
|
'eslint/no-alert': 'error',
|
|
293
303
|
|
|
294
304
|
// Disallow Array constructors
|
|
295
|
-
// https://
|
|
305
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-array-constructor.html
|
|
296
306
|
'eslint/no-array-constructor': 'error',
|
|
297
307
|
|
|
298
308
|
// Disallow bitwise operators
|
|
299
|
-
// https://
|
|
309
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-bitwise.html
|
|
300
310
|
'eslint/no-bitwise': 'error',
|
|
301
311
|
|
|
302
312
|
// Disallow the use of arguments.caller or arguments.callee
|
|
303
|
-
// https://
|
|
313
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-caller.html
|
|
304
314
|
'eslint/no-caller': 'error',
|
|
305
315
|
|
|
306
316
|
// Disallow lexical declarations in case clauses
|
|
307
|
-
// https://
|
|
317
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-case-declarations.html
|
|
308
318
|
'eslint/no-case-declarations': 'error',
|
|
309
319
|
|
|
310
320
|
// Disallow the use of console
|
|
311
|
-
// https://
|
|
321
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-console.html
|
|
312
322
|
'eslint/no-console': ['error', { allow: ['log', 'warn', 'error'] }],
|
|
313
323
|
|
|
314
324
|
// Disallow continue statements
|
|
315
|
-
// https://
|
|
325
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-continue.html
|
|
316
326
|
'eslint/no-continue': 'error',
|
|
317
327
|
|
|
318
328
|
// Disallow deleting variables
|
|
319
|
-
// https://
|
|
329
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-delete-var.html
|
|
320
330
|
'eslint/no-delete-var': 'error',
|
|
321
331
|
|
|
322
332
|
// Disallow else blocks after return statements in if statements
|
|
323
|
-
// https://
|
|
333
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-else-return.html
|
|
324
334
|
'eslint/no-else-return': ['error', { allowElseIf: false }],
|
|
325
335
|
|
|
326
336
|
// Disallow empty block statements
|
|
327
|
-
// https://
|
|
337
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty.html
|
|
328
338
|
'eslint/no-empty': 'error',
|
|
329
339
|
|
|
330
340
|
// Disallow empty functions
|
|
331
|
-
// https://
|
|
341
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty-function.html
|
|
332
342
|
'eslint/no-empty-function': ['error', { allow: ['arrowFunctions', 'functions', 'methods'] }],
|
|
333
343
|
|
|
334
344
|
// Disallow empty static blocks
|
|
335
|
-
// https://
|
|
345
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty-static-block.html
|
|
336
346
|
'eslint/no-empty-static-block': 'error',
|
|
337
347
|
|
|
338
348
|
// Disallow the use of eval()
|
|
339
|
-
// https://
|
|
349
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-eval.html
|
|
340
350
|
'eslint/no-eval': 'error',
|
|
341
351
|
|
|
342
352
|
// Disallow extending native types
|
|
343
|
-
// https://
|
|
353
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-extend-native.html
|
|
344
354
|
'eslint/no-extend-native': 'error',
|
|
345
355
|
|
|
346
356
|
// Disallow unnecessary calls to .bind()
|
|
347
|
-
// https://
|
|
357
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-extra-bind.html
|
|
348
358
|
'eslint/no-extra-bind': 'error',
|
|
349
359
|
|
|
350
360
|
// Disallow unnecessary boolean casts
|
|
351
|
-
// https://
|
|
361
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-extra-boolean-cast.html
|
|
352
362
|
'eslint/no-extra-boolean-cast': 'error',
|
|
353
363
|
|
|
354
364
|
// Disallow unnecessary labels
|
|
355
|
-
// https://
|
|
365
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-extra-label.html
|
|
356
366
|
'eslint/no-extra-label': 'error',
|
|
357
367
|
|
|
358
368
|
// Disallow assignments to native objects or read-only global variables
|
|
359
|
-
// https://
|
|
369
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-global-assign.html
|
|
360
370
|
'eslint/no-global-assign': 'error',
|
|
361
371
|
|
|
362
372
|
// Disallow shorthand type conversions
|
|
363
|
-
// https://
|
|
373
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implicit-coercion.html
|
|
364
374
|
'eslint/no-implicit-coercion': 'error',
|
|
365
375
|
|
|
366
376
|
// Disallow the use of the __iterator__ property
|
|
367
|
-
// https://
|
|
377
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-iterator.html
|
|
368
378
|
'eslint/no-iterator': 'error',
|
|
369
379
|
|
|
370
380
|
// Disallow labels that share a name with a variable
|
|
371
|
-
// https://
|
|
381
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-label-var.html
|
|
372
382
|
'eslint/no-label-var': 'error',
|
|
373
383
|
|
|
374
384
|
// Disallow labeled statements
|
|
375
|
-
// https://
|
|
385
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-labels.html
|
|
376
386
|
'eslint/no-labels': 'error',
|
|
377
387
|
|
|
378
388
|
// Disallow unnecessary nested blocks
|
|
379
|
-
// https://
|
|
389
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-lone-blocks.html
|
|
380
390
|
'eslint/no-lone-blocks': 'error',
|
|
381
391
|
|
|
382
392
|
// Disallow if statements as the only statement in else blocks
|
|
383
|
-
// https://
|
|
393
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-lonely-if.html
|
|
384
394
|
'eslint/no-lonely-if': 'error',
|
|
385
395
|
|
|
386
396
|
// Disallow function declarations that contain unsafe references inside loop statements
|
|
387
|
-
// https://
|
|
397
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-loop-func.html
|
|
388
398
|
'eslint/no-loop-func': 'error',
|
|
389
399
|
|
|
390
400
|
// Disallow magic numbers
|
|
391
|
-
// https://
|
|
392
|
-
// decision:
|
|
401
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-magic-numbers.html
|
|
402
|
+
// decision: this rule is too noisy to be a default and was commonly disabled inline
|
|
393
403
|
'eslint/no-magic-numbers': 'off',
|
|
394
404
|
|
|
395
405
|
// Disallow use of chained assignment expressions
|
|
396
|
-
// https://
|
|
406
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-multi-assign.html
|
|
397
407
|
'eslint/no-multi-assign': 'error',
|
|
398
408
|
|
|
399
409
|
// Disallow multiline strings
|
|
400
|
-
// https://
|
|
410
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-multi-str.html
|
|
401
411
|
'eslint/no-multi-str': 'error',
|
|
402
412
|
|
|
403
413
|
// Disallow nested ternary expressions
|
|
404
|
-
// https://
|
|
414
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-nested-ternary.html
|
|
405
415
|
'eslint/no-nested-ternary': 'error',
|
|
406
416
|
|
|
407
417
|
// Disallow new operators outside of assignments or comparisons
|
|
408
|
-
// https://
|
|
418
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-new.html
|
|
409
419
|
'eslint/no-new': 'error',
|
|
410
420
|
|
|
411
421
|
// Disallow new operators with the Function object
|
|
412
|
-
// https://
|
|
422
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-new-func.html
|
|
413
423
|
'eslint/no-new-func': 'error',
|
|
414
424
|
|
|
415
425
|
// Disallow new operators with the String, Number, and Boolean objects
|
|
416
|
-
// https://
|
|
426
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-new-wrappers.html
|
|
417
427
|
'eslint/no-new-wrappers': 'error',
|
|
418
428
|
|
|
419
429
|
// Disallow \8 and \9 escape sequences in string literals
|
|
420
|
-
// https://
|
|
430
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-nonoctal-decimal-escape.html
|
|
421
431
|
'eslint/no-nonoctal-decimal-escape': 'error',
|
|
422
432
|
|
|
423
433
|
// Disallow calls to the Object constructor without an argument
|
|
424
|
-
// https://
|
|
434
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-object-constructor.html
|
|
425
435
|
'eslint/no-object-constructor': 'error',
|
|
426
436
|
|
|
427
437
|
// Disallow reassigning function parameters
|
|
428
|
-
// https://
|
|
438
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-param-reassign.html
|
|
429
439
|
'eslint/no-param-reassign': [
|
|
430
440
|
'error',
|
|
431
441
|
{
|
|
@@ -447,112 +457,131 @@ export const baseRules = {
|
|
|
447
457
|
],
|
|
448
458
|
|
|
449
459
|
// Disallow the unary operators ++ and --
|
|
450
|
-
// https://
|
|
460
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-plusplus.html
|
|
451
461
|
'eslint/no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
|
452
462
|
|
|
453
463
|
// Disallow the use of the __proto__ property
|
|
454
|
-
// https://
|
|
464
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-proto.html
|
|
455
465
|
'eslint/no-proto': 'error',
|
|
456
466
|
|
|
457
467
|
// Disallow variable redeclaration
|
|
458
|
-
// https://
|
|
468
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-redeclare.html
|
|
459
469
|
'eslint/no-redeclare': 'error',
|
|
460
470
|
|
|
461
471
|
// Disallow multiple spaces in regular expressions
|
|
462
|
-
// https://
|
|
472
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-regex-spaces.html
|
|
463
473
|
'eslint/no-regex-spaces': 'error',
|
|
464
474
|
|
|
475
|
+
// Disallow certain global variables (confusing browser globals + isFinite/isNaN)
|
|
476
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-globals.html
|
|
477
|
+
'eslint/no-restricted-globals': [
|
|
478
|
+
'error',
|
|
479
|
+
{
|
|
480
|
+
restrictedGlobals: {
|
|
481
|
+
...Object.fromEntries(
|
|
482
|
+
confusingBrowserGlobals.map((name) => [
|
|
483
|
+
name,
|
|
484
|
+
`'${name}' should be written as 'window.${name}' or 'document.${name}' instead.`,
|
|
485
|
+
]),
|
|
486
|
+
),
|
|
487
|
+
isFinite: 'Use Number.isFinite instead...',
|
|
488
|
+
isNaN: 'Use Number.isNaN instead...',
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
],
|
|
492
|
+
|
|
465
493
|
// Disallow specified modules when loaded by import
|
|
466
|
-
// https://
|
|
494
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-imports.html
|
|
495
|
+
// decision: this should be set at a project-level config if necessary
|
|
467
496
|
'eslint/no-restricted-imports': 'off',
|
|
468
497
|
|
|
469
498
|
// Disallow assignment operators in return statements
|
|
470
|
-
// https://
|
|
499
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-return-assign.html
|
|
471
500
|
'eslint/no-return-assign': ['error', 'always'],
|
|
472
501
|
|
|
473
502
|
// Disallow use of javascript: urls
|
|
474
|
-
// https://
|
|
503
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-script-url.html
|
|
475
504
|
'eslint/no-script-url': 'error',
|
|
476
505
|
|
|
477
506
|
// Disallow comma operators
|
|
478
|
-
// https://
|
|
507
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-sequences.html
|
|
479
508
|
'eslint/no-sequences': 'error',
|
|
480
509
|
|
|
481
510
|
// Disallow variable declarations from shadowing variables declared in the outer scope
|
|
482
|
-
// https://
|
|
511
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-shadow.html
|
|
483
512
|
'eslint/no-shadow': 'error',
|
|
484
513
|
|
|
485
514
|
// Disallow identifiers from shadowing restricted names
|
|
486
|
-
// https://
|
|
515
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-shadow-restricted-names.html
|
|
487
516
|
'eslint/no-shadow-restricted-names': 'error',
|
|
488
517
|
|
|
489
518
|
// Disallow throwing literals as exceptions
|
|
490
|
-
// https://
|
|
519
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-throw-literal.html
|
|
491
520
|
'eslint/no-throw-literal': 'error',
|
|
492
521
|
|
|
493
522
|
// Disallow ternary operators when simpler alternatives exist
|
|
494
|
-
// https://
|
|
523
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unneeded-ternary.html
|
|
495
524
|
'eslint/no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
496
525
|
|
|
497
526
|
// Disallow unused expressions
|
|
498
|
-
// https://
|
|
527
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-expressions.html
|
|
499
528
|
'eslint/no-unused-expressions': 'error',
|
|
500
529
|
|
|
501
530
|
// Disallow unused labels
|
|
502
|
-
// https://
|
|
531
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-labels.html
|
|
503
532
|
'eslint/no-unused-labels': 'error',
|
|
504
533
|
|
|
505
534
|
// Disallow unnecessary catch clauses
|
|
506
|
-
// https://
|
|
535
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-catch.html
|
|
507
536
|
'eslint/no-useless-catch': 'error',
|
|
508
537
|
|
|
509
538
|
// Disallow unnecessary computed property keys in objects and classes
|
|
510
|
-
// https://
|
|
539
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-computed-key.html
|
|
511
540
|
'eslint/no-useless-computed-key': 'error',
|
|
512
541
|
|
|
513
542
|
// Disallow unnecessary concatenation of literals or template literals
|
|
514
|
-
// https://
|
|
543
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-concat.html
|
|
515
544
|
'eslint/no-useless-concat': 'error',
|
|
516
545
|
|
|
517
546
|
// Disallow unnecessary constructors
|
|
518
|
-
// https://
|
|
547
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-constructor.html
|
|
519
548
|
'eslint/no-useless-constructor': 'error',
|
|
520
549
|
|
|
521
550
|
// Disallow unnecessary escape characters
|
|
522
|
-
// https://
|
|
551
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-escape.html
|
|
523
552
|
'eslint/no-useless-escape': 'error',
|
|
524
553
|
|
|
525
554
|
// Disallow renaming import, export, and destructured assignments to the same name
|
|
526
|
-
// https://
|
|
555
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-rename.html
|
|
527
556
|
'eslint/no-useless-rename': 'error',
|
|
528
557
|
|
|
529
558
|
// Disallow redundant return statements
|
|
530
|
-
// https://
|
|
559
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-return.html
|
|
531
560
|
'eslint/no-useless-return': 'error',
|
|
532
561
|
|
|
533
562
|
// Require let or const instead of var
|
|
534
|
-
// https://
|
|
563
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-var.html
|
|
535
564
|
'eslint/no-var': 'error',
|
|
536
565
|
|
|
537
566
|
// Disallow void operators
|
|
538
|
-
// https://
|
|
567
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-void.html
|
|
539
568
|
'eslint/no-void': 'error',
|
|
540
569
|
// note: typescript.ts overrides this to ["error", { "allowAsStatement": true }]
|
|
541
570
|
|
|
542
571
|
// Disallow with statements
|
|
543
|
-
// https://
|
|
572
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-with.html
|
|
544
573
|
'eslint/no-with': 'error',
|
|
545
574
|
|
|
546
575
|
// Require or disallow assignment operator shorthand where possible
|
|
547
|
-
// https://
|
|
576
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/operator-assignment.html
|
|
548
577
|
'eslint/operator-assignment': ['error', 'always'],
|
|
549
578
|
|
|
550
579
|
// Require const declarations for variables that are never reassigned after declared
|
|
551
|
-
// https://
|
|
580
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-const.html
|
|
552
581
|
'eslint/prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }],
|
|
553
582
|
|
|
554
583
|
// Require destructuring from arrays and/or objects
|
|
555
|
-
// https://
|
|
584
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-destructuring.html
|
|
556
585
|
'eslint/prefer-destructuring': [
|
|
557
586
|
'error',
|
|
558
587
|
{
|
|
@@ -563,67 +592,67 @@ export const baseRules = {
|
|
|
563
592
|
],
|
|
564
593
|
|
|
565
594
|
// Disallow the use of Math.pow in favor of the ** operator
|
|
566
|
-
// https://
|
|
595
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-exponentiation-operator.html
|
|
567
596
|
'eslint/prefer-exponentiation-operator': 'error',
|
|
568
597
|
|
|
569
598
|
// Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
|
|
570
|
-
// https://
|
|
599
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-numeric-literals.html
|
|
571
600
|
'eslint/prefer-numeric-literals': 'error',
|
|
572
601
|
|
|
573
602
|
// Disallow use of Object.prototype.hasOwnProperty.call() and prefer use of Object.hasOwn()
|
|
574
|
-
// https://
|
|
603
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-object-has-own.html
|
|
575
604
|
'eslint/prefer-object-has-own': 'error',
|
|
576
605
|
|
|
577
606
|
// Prefer use of an object spread over Object.assign
|
|
578
|
-
// https://
|
|
607
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-object-spread.html
|
|
579
608
|
'eslint/prefer-object-spread': 'error',
|
|
580
609
|
|
|
581
610
|
// Require using Error objects as Promise rejection reasons
|
|
582
|
-
// https://
|
|
611
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-promise-reject-errors.html
|
|
583
612
|
'eslint/prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
584
613
|
|
|
585
614
|
// Require rest parameters instead of arguments
|
|
586
|
-
// https://
|
|
615
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-rest-params.html
|
|
587
616
|
'eslint/prefer-rest-params': 'error',
|
|
588
617
|
|
|
589
618
|
// Require spread operators instead of .apply()
|
|
590
|
-
// https://
|
|
619
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-spread.html
|
|
591
620
|
'eslint/prefer-spread': 'error',
|
|
592
621
|
|
|
593
622
|
// Require template literals instead of string concatenation
|
|
594
|
-
// https://
|
|
623
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-template.html
|
|
595
624
|
'eslint/prefer-template': 'error',
|
|
596
625
|
|
|
597
626
|
// Disallow losing originally caught error when re-throwing custom errors
|
|
598
|
-
// https://
|
|
627
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/preserve-caught-error.html
|
|
599
628
|
'eslint/preserve-caught-error': ['error', { requireCatchParameter: false }],
|
|
600
629
|
|
|
601
630
|
// Enforce the consistent use of the radix argument when using parseInt()
|
|
602
|
-
// https://
|
|
631
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/radix.html
|
|
603
632
|
'eslint/radix': 'error',
|
|
604
633
|
|
|
605
634
|
// Disallow async functions which have no await expression
|
|
606
|
-
// https://
|
|
635
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/require-await.html
|
|
607
636
|
'eslint/require-await': 'error',
|
|
608
637
|
|
|
609
638
|
// Require generator functions to contain yield
|
|
610
|
-
// https://
|
|
639
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/require-yield.html
|
|
611
640
|
'eslint/require-yield': 'error',
|
|
612
641
|
|
|
613
642
|
// Require symbol descriptions
|
|
614
|
-
// https://
|
|
643
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/symbol-description.html
|
|
615
644
|
'eslint/symbol-description': 'error',
|
|
616
645
|
|
|
617
646
|
// Require or disallow Unicode byte order mark (BOM)
|
|
618
|
-
// https://
|
|
647
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/unicode-bom.html
|
|
619
648
|
'eslint/unicode-bom': ['error', 'never'],
|
|
620
649
|
|
|
621
650
|
// Require var declarations be placed at the top of their containing scope
|
|
622
|
-
// https://
|
|
651
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/vars-on-top.html
|
|
623
652
|
'eslint/vars-on-top': 'error',
|
|
624
653
|
|
|
625
654
|
// Require or disallow "Yoda" conditions
|
|
626
|
-
// https://
|
|
655
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/yoda.html
|
|
627
656
|
'eslint/yoda': 'error',
|
|
628
657
|
|
|
629
658
|
//oxc rules - these are bug-catchers that oxlint can detect natively.
|