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