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