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