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