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