@wistia/oxlint-config 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/javascript.mjs +13 -0
- package/configs/node.mjs +8 -0
- package/configs/playwright.mjs +7 -0
- package/configs/react.mjs +11 -0
- package/configs/storybook.mjs +7 -0
- package/configs/styled-components.mjs +7 -0
- package/configs/testing-library.mjs +7 -0
- package/configs/typescript.mjs +20 -0
- package/configs/vitest.mjs +8 -0
- package/index.mjs +24 -0
- package/package.json +10 -16
- package/rules/{base.jsonc → base.mjs} +179 -184
- package/rules/{import.jsonc → import.mjs} +30 -32
- package/rules/{node.jsonc → node.mjs} +37 -39
- package/rules/{playwright.jsonc → playwright.mjs} +52 -54
- package/rules/{promise.jsonc → promise.mjs} +20 -22
- package/rules/{react-a11y.jsonc → react-a11y.mjs} +48 -50
- package/rules/{react.jsonc → react.mjs} +55 -57
- package/rules/{storybook.jsonc → storybook.mjs} +20 -22
- package/rules/styled-components.mjs +151 -0
- package/rules/{testing-library.jsonc → testing-library.mjs} +48 -50
- package/rules/{typescript.jsonc → typescript.mjs} +134 -136
- package/rules/{vitest.jsonc → vitest.mjs} +87 -89
- 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,48 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"categories": {},
|
|
5
|
-
"rules": {
|
|
1
|
+
export const typescriptRules = {
|
|
2
|
+
plugins: ['typescript'],
|
|
3
|
+
rules: {
|
|
6
4
|
// -- Disable base eslint rules superseded by typescript equivalents --
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
'eslint/class-methods-use-this': 'off',
|
|
6
|
+
'eslint/default-param-last': 'off',
|
|
7
|
+
'eslint/init-declarations': 'off',
|
|
8
|
+
'eslint/max-params': 'off',
|
|
9
|
+
'eslint/no-array-constructor': 'off',
|
|
10
|
+
'eslint/no-dupe-class-members': 'off',
|
|
11
|
+
'eslint/no-empty-function': 'off',
|
|
12
|
+
'eslint/no-loop-func': 'off',
|
|
13
|
+
'eslint/no-magic-numbers': 'off',
|
|
14
|
+
'eslint/no-redeclare': 'off',
|
|
15
|
+
'eslint/no-restricted-imports': 'off',
|
|
16
|
+
'eslint/no-shadow': 'off',
|
|
17
|
+
'eslint/no-throw-literal': 'off',
|
|
18
|
+
'eslint/no-unused-expressions': 'off',
|
|
19
|
+
'eslint/no-unused-private-class-members': 'off',
|
|
20
|
+
'eslint/no-unused-vars': 'off',
|
|
21
|
+
'eslint/no-use-before-define': 'off',
|
|
22
|
+
'eslint/no-useless-constructor': 'off',
|
|
23
|
+
'eslint/prefer-destructuring': 'off',
|
|
24
|
+
'eslint/require-await': 'off',
|
|
27
25
|
|
|
28
26
|
// recommended to be disabled for TypeScript projects
|
|
29
27
|
// https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/TROUBLESHOOTING.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|
30
|
-
|
|
28
|
+
'eslint/no-undef': 'off',
|
|
31
29
|
|
|
32
30
|
// Override base no-void to allow void as a statement (common in TS for fire-and-forget promises)
|
|
33
|
-
|
|
31
|
+
'eslint/no-void': ['error', { allowAsStatement: true }],
|
|
34
32
|
|
|
35
33
|
// Override base id-length to disable checking generic type parameters.
|
|
36
34
|
// ESLint's id-length never sees TS type params (they're not in the ESLint AST),
|
|
37
35
|
// but oxlint has native TS support so it checks them. Setting checkGeneric to
|
|
38
36
|
// false restores parity with ESLint's behavior.
|
|
39
37
|
// https://oxc.rs/docs/guide/usage/linter/rules/eslint/id-length.html
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
'eslint/id-length': [
|
|
39
|
+
'error',
|
|
42
40
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
min: 2,
|
|
42
|
+
exceptions: ['_', 'i', 'j', 'x', 'y'],
|
|
43
|
+
checkGeneric: false,
|
|
46
44
|
},
|
|
47
45
|
],
|
|
48
46
|
|
|
@@ -50,408 +48,408 @@
|
|
|
50
48
|
|
|
51
49
|
// Require that function overload signatures be consecutive
|
|
52
50
|
// https://typescript-eslint.io/rules/adjacent-overload-signatures
|
|
53
|
-
|
|
51
|
+
'typescript/adjacent-overload-signatures': 'error',
|
|
54
52
|
|
|
55
53
|
// Require consistently using either T[] or Array<T> for arrays
|
|
56
54
|
// https://typescript-eslint.io/rules/array-type
|
|
57
|
-
|
|
55
|
+
'typescript/array-type': 'error',
|
|
58
56
|
|
|
59
57
|
// Disallow awaiting a value that is not a Thenable
|
|
60
58
|
// https://typescript-eslint.io/rules/await-thenable
|
|
61
|
-
|
|
59
|
+
'typescript/await-thenable': 'error',
|
|
62
60
|
|
|
63
61
|
// Disallow @ts-<directive> comments or require descriptions after directives
|
|
64
62
|
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
65
|
-
|
|
63
|
+
'typescript/ban-ts-comment': 'error',
|
|
66
64
|
|
|
67
65
|
// Disallow // tslint:<rule-flag> comments
|
|
68
66
|
// https://typescript-eslint.io/rules/ban-tslint-comment
|
|
69
|
-
|
|
67
|
+
'typescript/ban-tslint-comment': 'error',
|
|
70
68
|
|
|
71
69
|
// Enforce that literals on classes are exposed in a consistent style
|
|
72
70
|
// https://typescript-eslint.io/rules/class-literal-property-style
|
|
73
|
-
|
|
71
|
+
'typescript/class-literal-property-style': 'error',
|
|
74
72
|
|
|
75
73
|
// Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
|
|
76
74
|
// https://typescript-eslint.io/rules/consistent-generic-constructors
|
|
77
|
-
|
|
75
|
+
'typescript/consistent-generic-constructors': 'error',
|
|
78
76
|
|
|
79
77
|
// Require or disallow the Record type
|
|
80
78
|
// https://typescript-eslint.io/rules/consistent-indexed-object-style
|
|
81
|
-
|
|
79
|
+
'typescript/consistent-indexed-object-style': 'error',
|
|
82
80
|
|
|
83
81
|
// Enforce consistent usage of type assertions
|
|
84
82
|
// https://typescript-eslint.io/rules/consistent-type-assertions
|
|
85
|
-
|
|
83
|
+
'typescript/consistent-type-assertions': 'error',
|
|
86
84
|
|
|
87
85
|
// Enforce type definitions to consistently use either interface or type
|
|
88
86
|
// https://typescript-eslint.io/rules/consistent-type-definitions
|
|
89
87
|
// decision: prefer type to interface for consistency
|
|
90
|
-
|
|
88
|
+
'typescript/consistent-type-definitions': ['error', 'type'],
|
|
91
89
|
|
|
92
90
|
// Enforce consistent usage of type exports
|
|
93
91
|
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
94
|
-
|
|
92
|
+
'typescript/consistent-type-exports': 'error',
|
|
95
93
|
|
|
96
94
|
// Enforce consistent usage of type imports
|
|
97
95
|
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
'typescript/consistent-type-imports': [
|
|
97
|
+
'error',
|
|
100
98
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
prefer: 'type-imports',
|
|
100
|
+
disallowTypeAnnotations: false,
|
|
101
|
+
fixStyle: 'separate-type-imports',
|
|
104
102
|
},
|
|
105
103
|
],
|
|
106
104
|
|
|
107
105
|
// Enforce dot notation whenever possible
|
|
108
106
|
// https://typescript-eslint.io/rules/dot-notation
|
|
109
|
-
|
|
107
|
+
'typescript/dot-notation': 'error',
|
|
110
108
|
|
|
111
109
|
// Require explicit accessibility modifiers on class properties and methods
|
|
112
110
|
// https://typescript-eslint.io/rules/explicit-module-boundary-types
|
|
113
|
-
|
|
111
|
+
'typescript/explicit-module-boundary-types': 'error',
|
|
114
112
|
|
|
115
113
|
// Disallow using the delete operator on array values
|
|
116
114
|
// https://typescript-eslint.io/rules/no-array-delete
|
|
117
|
-
|
|
115
|
+
'typescript/no-array-delete': 'error',
|
|
118
116
|
|
|
119
117
|
// Require .toString() to only be called on objects which provide useful information
|
|
120
118
|
// https://typescript-eslint.io/rules/no-base-to-string
|
|
121
|
-
|
|
119
|
+
'typescript/no-base-to-string': 'error',
|
|
122
120
|
|
|
123
121
|
// Disallow non-null assertion in locations that may be confusing
|
|
124
122
|
// https://typescript-eslint.io/rules/no-confusing-non-null-assertion
|
|
125
|
-
|
|
123
|
+
'typescript/no-confusing-non-null-assertion': 'error',
|
|
126
124
|
|
|
127
125
|
// Require expressions of type void to appear in statement position
|
|
128
126
|
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
129
|
-
|
|
127
|
+
'typescript/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }],
|
|
130
128
|
|
|
131
129
|
// Disallow using code marked as @deprecated
|
|
132
130
|
// https://typescript-eslint.io/rules/no-deprecated
|
|
133
|
-
|
|
131
|
+
'typescript/no-deprecated': 'error',
|
|
134
132
|
|
|
135
133
|
// Disallow duplicate enum member values
|
|
136
134
|
// https://typescript-eslint.io/rules/no-duplicate-enum-values
|
|
137
|
-
|
|
135
|
+
'typescript/no-duplicate-enum-values': 'error',
|
|
138
136
|
|
|
139
137
|
// Disallow duplicate constituents of union or intersection types
|
|
140
138
|
// https://typescript-eslint.io/rules/no-duplicate-type-constituents
|
|
141
|
-
|
|
139
|
+
'typescript/no-duplicate-type-constituents': 'error',
|
|
142
140
|
|
|
143
141
|
// Disallow using the delete operator on computed key expressions
|
|
144
142
|
// https://typescript-eslint.io/rules/no-dynamic-delete
|
|
145
|
-
|
|
143
|
+
'typescript/no-dynamic-delete': 'error',
|
|
146
144
|
|
|
147
145
|
// Disallow accidentally using the "empty object" type
|
|
148
146
|
// https://typescript-eslint.io/rules/no-empty-object-type
|
|
149
|
-
|
|
147
|
+
'typescript/no-empty-object-type': 'error',
|
|
150
148
|
|
|
151
149
|
// Disallow the any type
|
|
152
150
|
// https://typescript-eslint.io/rules/no-explicit-any
|
|
153
|
-
|
|
151
|
+
'typescript/no-explicit-any': 'error',
|
|
154
152
|
|
|
155
153
|
// Disallow extra non-null assertions
|
|
156
154
|
// https://typescript-eslint.io/rules/no-extra-non-null-assertion
|
|
157
|
-
|
|
155
|
+
'typescript/no-extra-non-null-assertion': 'error',
|
|
158
156
|
|
|
159
157
|
// Disallow classes used as namespaces
|
|
160
158
|
// https://typescript-eslint.io/rules/no-extraneous-class
|
|
161
|
-
|
|
159
|
+
'typescript/no-extraneous-class': 'error',
|
|
162
160
|
|
|
163
161
|
// Require Promise-like statements to be handled appropriately
|
|
164
162
|
// https://typescript-eslint.io/rules/no-floating-promises
|
|
165
|
-
|
|
163
|
+
'typescript/no-floating-promises': 'error',
|
|
166
164
|
|
|
167
165
|
// Disallow iterating over an array with a for-in loop
|
|
168
166
|
// https://typescript-eslint.io/rules/no-for-in-array
|
|
169
|
-
|
|
167
|
+
'typescript/no-for-in-array': 'error',
|
|
170
168
|
|
|
171
169
|
// Disallow the use of eval()-like methods
|
|
172
170
|
// https://typescript-eslint.io/rules/no-implied-eval
|
|
173
|
-
|
|
171
|
+
'typescript/no-implied-eval': 'error',
|
|
174
172
|
|
|
175
173
|
// Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
|
|
176
174
|
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
177
|
-
|
|
175
|
+
'typescript/no-import-type-side-effects': 'error',
|
|
178
176
|
|
|
179
177
|
// Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
|
|
180
178
|
// https://typescript-eslint.io/rules/no-inferrable-types
|
|
181
|
-
|
|
179
|
+
'typescript/no-inferrable-types': 'error',
|
|
182
180
|
|
|
183
181
|
// Disallow void type outside of generic or return types
|
|
184
182
|
// https://typescript-eslint.io/rules/no-invalid-void-type
|
|
185
|
-
|
|
183
|
+
'typescript/no-invalid-void-type': 'error',
|
|
186
184
|
|
|
187
185
|
// Disallow the void operator except when used to discard a value
|
|
188
186
|
// https://typescript-eslint.io/rules/no-meaningless-void-operator
|
|
189
|
-
|
|
187
|
+
'typescript/no-meaningless-void-operator': 'error',
|
|
190
188
|
|
|
191
189
|
// Enforce valid definition of new and constructor
|
|
192
190
|
// https://typescript-eslint.io/rules/no-misused-new
|
|
193
|
-
|
|
191
|
+
'typescript/no-misused-new': 'error',
|
|
194
192
|
|
|
195
193
|
// Disallow Promises in places not designed to handle them
|
|
196
194
|
// https://typescript-eslint.io/rules/no-misused-promises
|
|
197
|
-
|
|
195
|
+
'typescript/no-misused-promises': 'error',
|
|
198
196
|
|
|
199
197
|
// Disallow using the spread operator when it might cause unexpected behavior
|
|
200
198
|
// https://typescript-eslint.io/rules/no-misused-spread
|
|
201
|
-
|
|
199
|
+
'typescript/no-misused-spread': 'error',
|
|
202
200
|
|
|
203
201
|
// Disallow enums from having both number and string members
|
|
204
202
|
// https://typescript-eslint.io/rules/no-mixed-enums
|
|
205
|
-
|
|
203
|
+
'typescript/no-mixed-enums': 'error',
|
|
206
204
|
|
|
207
205
|
// Disallow TypeScript namespaces
|
|
208
206
|
// https://typescript-eslint.io/rules/no-namespace
|
|
209
|
-
|
|
207
|
+
'typescript/no-namespace': 'error',
|
|
210
208
|
|
|
211
209
|
// Disallow non-null assertions in the left operand of a nullish coalescing operator
|
|
212
210
|
// https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
|
|
213
|
-
|
|
211
|
+
'typescript/no-non-null-asserted-nullish-coalescing': 'error',
|
|
214
212
|
|
|
215
213
|
// Disallow non-null assertions after an optional chain expression
|
|
216
214
|
// https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
|
|
217
|
-
|
|
215
|
+
'typescript/no-non-null-asserted-optional-chain': 'error',
|
|
218
216
|
|
|
219
217
|
// Disallow non-null assertions using the ! postfix operator
|
|
220
218
|
// https://typescript-eslint.io/rules/no-non-null-assertion
|
|
221
|
-
|
|
219
|
+
'typescript/no-non-null-assertion': 'error',
|
|
222
220
|
|
|
223
221
|
// Disallow members of unions and intersections that do nothing or override type information
|
|
224
222
|
// https://typescript-eslint.io/rules/no-redundant-type-constituents
|
|
225
|
-
|
|
223
|
+
'typescript/no-redundant-type-constituents': 'error',
|
|
226
224
|
|
|
227
225
|
// Disallow invocation of require()
|
|
228
226
|
// https://typescript-eslint.io/rules/no-require-imports
|
|
229
|
-
|
|
227
|
+
'typescript/no-require-imports': 'error',
|
|
230
228
|
|
|
231
229
|
// Disallow certain types
|
|
232
230
|
// https://typescript-eslint.io/rules/no-restricted-types
|
|
233
|
-
|
|
231
|
+
'typescript/no-restricted-types': 'error',
|
|
234
232
|
|
|
235
233
|
// Disallow aliasing this
|
|
236
234
|
// https://typescript-eslint.io/rules/no-this-alias
|
|
237
|
-
|
|
235
|
+
'typescript/no-this-alias': 'error',
|
|
238
236
|
|
|
239
237
|
// Disallow unnecessary equality comparisons against boolean literals
|
|
240
238
|
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
241
|
-
|
|
239
|
+
'typescript/no-unnecessary-boolean-literal-compare': 'error',
|
|
242
240
|
|
|
243
241
|
// Disallow conditionals where the type is always truthy or always falsy
|
|
244
242
|
// https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
245
|
-
|
|
243
|
+
'typescript/no-unnecessary-condition': 'error',
|
|
246
244
|
|
|
247
245
|
// Disallow unnecessary assignment of constructor property parameter
|
|
248
246
|
// https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
|
|
249
|
-
|
|
247
|
+
'typescript/no-unnecessary-parameter-property-assignment': 'error',
|
|
250
248
|
|
|
251
249
|
// Disallow unnecessary namespace qualifiers
|
|
252
250
|
// https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
253
|
-
|
|
251
|
+
'typescript/no-unnecessary-qualifier': 'error',
|
|
254
252
|
|
|
255
253
|
// Disallow unnecessary template expressions
|
|
256
254
|
// https://typescript-eslint.io/rules/no-unnecessary-template-expression
|
|
257
|
-
|
|
255
|
+
'typescript/no-unnecessary-template-expression': 'error',
|
|
258
256
|
|
|
259
257
|
// Disallow type arguments that are equal to the default
|
|
260
258
|
// https://typescript-eslint.io/rules/no-unnecessary-type-arguments
|
|
261
|
-
|
|
259
|
+
'typescript/no-unnecessary-type-arguments': 'error',
|
|
262
260
|
|
|
263
261
|
// Disallow type assertions that do not change the type of an expression
|
|
264
262
|
// https://typescript-eslint.io/rules/no-unnecessary-type-assertion
|
|
265
|
-
|
|
263
|
+
'typescript/no-unnecessary-type-assertion': 'error',
|
|
266
264
|
|
|
267
265
|
// Disallow unnecessary constraints on generic types
|
|
268
266
|
// https://typescript-eslint.io/rules/no-unnecessary-type-constraint
|
|
269
|
-
|
|
267
|
+
'typescript/no-unnecessary-type-constraint': 'error',
|
|
270
268
|
|
|
271
269
|
// Disallow conversion idioms when they do not change the type or value of the expression
|
|
272
270
|
// https://typescript-eslint.io/rules/no-unnecessary-type-conversion
|
|
273
|
-
|
|
271
|
+
'typescript/no-unnecessary-type-conversion': 'error',
|
|
274
272
|
|
|
275
273
|
// Disallow type parameters that only appear once
|
|
276
274
|
// https://typescript-eslint.io/rules/no-unnecessary-type-parameters
|
|
277
|
-
|
|
275
|
+
'typescript/no-unnecessary-type-parameters': 'error',
|
|
278
276
|
|
|
279
277
|
// Disallow calling a function with a value with type any
|
|
280
278
|
// https://typescript-eslint.io/rules/no-unsafe-argument
|
|
281
|
-
|
|
279
|
+
'typescript/no-unsafe-argument': 'error',
|
|
282
280
|
|
|
283
281
|
// Disallow assigning a value with type any to variables and properties
|
|
284
282
|
// https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
285
|
-
|
|
283
|
+
'typescript/no-unsafe-assignment': 'error',
|
|
286
284
|
|
|
287
285
|
// Disallow calling a value with type any
|
|
288
286
|
// https://typescript-eslint.io/rules/no-unsafe-call
|
|
289
|
-
|
|
287
|
+
'typescript/no-unsafe-call': 'error',
|
|
290
288
|
|
|
291
289
|
// Disallow unsafe declaration merging
|
|
292
290
|
// https://typescript-eslint.io/rules/no-unsafe-declaration-merging
|
|
293
|
-
|
|
291
|
+
'typescript/no-unsafe-declaration-merging': 'error',
|
|
294
292
|
|
|
295
293
|
// Disallow comparing an enum value with a non-enum value
|
|
296
294
|
// https://typescript-eslint.io/rules/no-unsafe-enum-comparison
|
|
297
|
-
|
|
295
|
+
'typescript/no-unsafe-enum-comparison': 'error',
|
|
298
296
|
|
|
299
297
|
// Disallow using the unsafe built-in Function type
|
|
300
298
|
// https://typescript-eslint.io/rules/no-unsafe-function-type
|
|
301
|
-
|
|
299
|
+
'typescript/no-unsafe-function-type': 'error',
|
|
302
300
|
|
|
303
301
|
// Disallow member access on a value with type any
|
|
304
302
|
// https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
305
|
-
|
|
303
|
+
'typescript/no-unsafe-member-access': 'error',
|
|
306
304
|
|
|
307
305
|
// Disallow returning a value with type any from a function
|
|
308
306
|
// https://typescript-eslint.io/rules/no-unsafe-return
|
|
309
|
-
|
|
307
|
+
'typescript/no-unsafe-return': 'error',
|
|
310
308
|
|
|
311
309
|
// Disallow type assertions that narrow a type
|
|
312
310
|
// https://typescript-eslint.io/rules/no-unsafe-type-assertion
|
|
313
|
-
|
|
311
|
+
'typescript/no-unsafe-type-assertion': 'error',
|
|
314
312
|
|
|
315
313
|
// Require unary negation to take a number
|
|
316
314
|
// https://typescript-eslint.io/rules/no-unsafe-unary-minus
|
|
317
|
-
|
|
315
|
+
'typescript/no-unsafe-unary-minus': 'error',
|
|
318
316
|
|
|
319
317
|
// Disallow empty exports that don't change anything in a module file
|
|
320
318
|
// https://typescript-eslint.io/rules/no-useless-empty-export
|
|
321
|
-
|
|
319
|
+
'typescript/no-useless-empty-export': 'error',
|
|
322
320
|
|
|
323
321
|
// Disallow using confusing built-in primitive class wrappers
|
|
324
322
|
// https://typescript-eslint.io/rules/no-wrapper-object-types
|
|
325
|
-
|
|
323
|
+
'typescript/no-wrapper-object-types': 'error',
|
|
326
324
|
|
|
327
325
|
// Enforce non-null assertions over explicit type casts
|
|
328
326
|
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style
|
|
329
327
|
// decision: disabled because it conflicts with `no-non-null-assertion` — this rule's autofix
|
|
330
328
|
// rewrites `value as T` to `value!`, which `no-non-null-assertion` then rejects
|
|
331
|
-
|
|
329
|
+
'typescript/non-nullable-type-assertion-style': 'off',
|
|
332
330
|
|
|
333
331
|
// Disallow throwing non-Error values as exceptions
|
|
334
332
|
// https://typescript-eslint.io/rules/only-throw-error
|
|
335
|
-
|
|
333
|
+
'typescript/only-throw-error': 'error',
|
|
336
334
|
|
|
337
335
|
// Require or disallow parameter properties in class constructors
|
|
338
336
|
// https://typescript-eslint.io/rules/parameter-properties
|
|
339
|
-
|
|
337
|
+
'typescript/parameter-properties': 'error',
|
|
340
338
|
|
|
341
339
|
// Enforce the use of as const over literal type
|
|
342
340
|
// https://typescript-eslint.io/rules/prefer-as-const
|
|
343
|
-
|
|
341
|
+
'typescript/prefer-as-const': 'error',
|
|
344
342
|
|
|
345
343
|
// Require each enum member value to be explicitly initialized
|
|
346
344
|
// https://typescript-eslint.io/rules/prefer-enum-initializers
|
|
347
|
-
|
|
345
|
+
'typescript/prefer-enum-initializers': 'error',
|
|
348
346
|
|
|
349
347
|
// Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0]
|
|
350
348
|
// https://typescript-eslint.io/rules/prefer-find
|
|
351
|
-
|
|
349
|
+
'typescript/prefer-find': 'error',
|
|
352
350
|
|
|
353
351
|
// Enforce the use of for-of loop over the standard for loop where possible
|
|
354
352
|
// https://typescript-eslint.io/rules/prefer-for-of
|
|
355
|
-
|
|
353
|
+
'typescript/prefer-for-of': 'error',
|
|
356
354
|
|
|
357
355
|
// Enforce using function types instead of interfaces with call signatures
|
|
358
356
|
// https://typescript-eslint.io/rules/prefer-function-type
|
|
359
|
-
|
|
357
|
+
'typescript/prefer-function-type': 'error',
|
|
360
358
|
|
|
361
359
|
// Enforce includes method over indexOf method
|
|
362
360
|
// https://typescript-eslint.io/rules/prefer-includes
|
|
363
|
-
|
|
361
|
+
'typescript/prefer-includes': 'error',
|
|
364
362
|
|
|
365
363
|
// Require all enum members to be literal values
|
|
366
364
|
// https://typescript-eslint.io/rules/prefer-literal-enum-member
|
|
367
|
-
|
|
365
|
+
'typescript/prefer-literal-enum-member': 'error',
|
|
368
366
|
|
|
369
367
|
// Require using namespace keyword over module keyword to declare custom TypeScript modules
|
|
370
368
|
// https://typescript-eslint.io/rules/prefer-namespace-keyword
|
|
371
|
-
|
|
369
|
+
'typescript/prefer-namespace-keyword': 'error',
|
|
372
370
|
|
|
373
371
|
// Enforce using the nullish coalescing operator instead of logical assignments or chaining
|
|
374
372
|
// https://typescript-eslint.io/rules/prefer-nullish-coalescing
|
|
375
|
-
|
|
373
|
+
'typescript/prefer-nullish-coalescing': 'error',
|
|
376
374
|
|
|
377
375
|
// Enforce using concise optional chain expressions
|
|
378
376
|
// https://typescript-eslint.io/rules/prefer-optional-chain
|
|
379
|
-
|
|
377
|
+
'typescript/prefer-optional-chain': 'error',
|
|
380
378
|
|
|
381
379
|
// Require using Error objects as Promise rejection reasons
|
|
382
380
|
// https://typescript-eslint.io/rules/prefer-promise-reject-errors
|
|
383
|
-
|
|
381
|
+
'typescript/prefer-promise-reject-errors': 'error',
|
|
384
382
|
|
|
385
383
|
// Require private members to be marked as readonly if they're never modified outside of the constructor
|
|
386
384
|
// https://typescript-eslint.io/rules/prefer-readonly
|
|
387
|
-
|
|
385
|
+
'typescript/prefer-readonly': 'error',
|
|
388
386
|
|
|
389
387
|
// Enforce using type parameter when calling Array#reduce instead of casting
|
|
390
388
|
// https://typescript-eslint.io/rules/prefer-reduce-type-parameter
|
|
391
|
-
|
|
389
|
+
'typescript/prefer-reduce-type-parameter': 'error',
|
|
392
390
|
|
|
393
391
|
// Enforce RegExp#exec over String#match if no global flag is provided
|
|
394
392
|
// https://typescript-eslint.io/rules/prefer-regexp-exec
|
|
395
|
-
|
|
393
|
+
'typescript/prefer-regexp-exec': 'error',
|
|
396
394
|
|
|
397
395
|
// Enforce that this is used when only this type is returned
|
|
398
396
|
// https://typescript-eslint.io/rules/prefer-return-this-type
|
|
399
|
-
|
|
397
|
+
'typescript/prefer-return-this-type': 'error',
|
|
400
398
|
|
|
401
399
|
// Enforce using String#startsWith and String#endsWith over other equivalent methods
|
|
402
400
|
// https://typescript-eslint.io/rules/prefer-string-starts-ends-with
|
|
403
|
-
|
|
401
|
+
'typescript/prefer-string-starts-ends-with': 'error',
|
|
404
402
|
|
|
405
403
|
// Require any function or method that returns a Promise to be marked async
|
|
406
404
|
// https://typescript-eslint.io/rules/promise-function-async
|
|
407
|
-
|
|
405
|
+
'typescript/promise-function-async': 'error',
|
|
408
406
|
|
|
409
407
|
// Enforce that get() types should be assignable to their equivalent set() type
|
|
410
408
|
// https://typescript-eslint.io/rules/related-getter-setter-pairs
|
|
411
|
-
|
|
409
|
+
'typescript/related-getter-setter-pairs': 'error',
|
|
412
410
|
|
|
413
411
|
// Require Array#sort and Array#toSorted calls to always provide a compareFunction
|
|
414
412
|
// https://typescript-eslint.io/rules/require-array-sort-compare
|
|
415
|
-
|
|
413
|
+
'typescript/require-array-sort-compare': 'error',
|
|
416
414
|
|
|
417
415
|
// Disallow async functions which do not return promises and have no await expression
|
|
418
416
|
// https://typescript-eslint.io/rules/require-await
|
|
419
|
-
|
|
417
|
+
'typescript/require-await': 'error',
|
|
420
418
|
|
|
421
419
|
// Require both operands of addition to be the same type
|
|
422
420
|
// https://typescript-eslint.io/rules/restrict-plus-operands
|
|
423
|
-
|
|
421
|
+
'typescript/restrict-plus-operands': 'error',
|
|
424
422
|
|
|
425
423
|
// Enforce template literal expressions to be of string type
|
|
426
424
|
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
427
|
-
|
|
425
|
+
'typescript/restrict-template-expressions': 'error',
|
|
428
426
|
|
|
429
427
|
// Enforce consistent awaiting of returned promises
|
|
430
428
|
// https://typescript-eslint.io/rules/return-await
|
|
431
|
-
|
|
429
|
+
'typescript/return-await': 'error',
|
|
432
430
|
|
|
433
431
|
// Disallow certain types in boolean expressions
|
|
434
432
|
// https://typescript-eslint.io/rules/strict-boolean-expressions
|
|
435
|
-
|
|
433
|
+
'typescript/strict-boolean-expressions': ['error', { allowNullableBoolean: true }],
|
|
436
434
|
|
|
437
435
|
// Require switch-case statements to be exhaustive
|
|
438
436
|
// https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
439
|
-
|
|
437
|
+
'typescript/switch-exhaustiveness-check': 'error',
|
|
440
438
|
|
|
441
439
|
// Disallow certain triple slash directives in favor of ES6-style import declarations
|
|
442
440
|
// https://typescript-eslint.io/rules/triple-slash-reference
|
|
443
|
-
|
|
441
|
+
'typescript/triple-slash-reference': 'error',
|
|
444
442
|
|
|
445
443
|
// Enforce unbound methods are called with their expected scope
|
|
446
444
|
// https://typescript-eslint.io/rules/unbound-method
|
|
447
|
-
|
|
445
|
+
'typescript/unbound-method': 'error',
|
|
448
446
|
|
|
449
447
|
// Disallow two overloads that could be unified into one
|
|
450
448
|
// https://typescript-eslint.io/rules/unified-signatures
|
|
451
|
-
|
|
449
|
+
'typescript/unified-signatures': 'error',
|
|
452
450
|
|
|
453
451
|
// Enforce typing arguments in .catch() callbacks as unknown
|
|
454
452
|
// https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
455
|
-
|
|
453
|
+
'typescript/use-unknown-in-catch-callback-variable': 'error',
|
|
456
454
|
},
|
|
457
|
-
}
|
|
455
|
+
};
|