@wistia/oxlint-config 0.8.1 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/oxlint-config",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Wistia's Oxlint configurations",
5
5
  "packageManager": "yarn@4.14.1",
6
6
  "type": "module",
@@ -55,8 +55,8 @@
55
55
  "oxlint-tsgolint": ">= 1.0.0"
56
56
  },
57
57
  "dependencies": {
58
- "@eslint-react/eslint-plugin": "^5.8.3",
59
- "@vitest/eslint-plugin": "^1.6.17",
58
+ "@eslint-react/eslint-plugin": "^5.8.5",
59
+ "@vitest/eslint-plugin": "^1.6.18",
60
60
  "confusing-browser-globals": "^1.0.11",
61
61
  "eslint-plugin-barrel-files": "^3.0.1",
62
62
  "eslint-plugin-import-x": "^4.16.2",
@@ -64,7 +64,7 @@
64
64
  "eslint-plugin-n": "^18.0.1",
65
65
  "eslint-plugin-no-only-tests": "^3.4.0",
66
66
  "eslint-plugin-playwright": "^2.10.4",
67
- "eslint-plugin-storybook": "^10.4.0",
67
+ "eslint-plugin-storybook": "^10.4.1",
68
68
  "eslint-plugin-styled-components": "^0.0.0",
69
69
  "eslint-plugin-styled-components-a11y": "^2.2.1",
70
70
  "eslint-plugin-testing-library": "^7.16.2",
@@ -74,10 +74,10 @@
74
74
  "@changesets/changelog-github": "^0.7.0",
75
75
  "@changesets/cli": "^2.31.0",
76
76
  "eslint": "^10.4.0",
77
- "oxfmt": "^0.51.0",
78
- "oxlint": "^1.66.0",
77
+ "oxfmt": "^0.52.0",
78
+ "oxlint": "^1.67.0",
79
79
  "oxlint-tsgolint": "^0.23.0",
80
- "storybook": "^10.4.0",
80
+ "storybook": "^10.4.1",
81
81
  "vitest": "^4.1.7"
82
82
  },
83
83
  "engines": {
package/rules/unicorn.mjs CHANGED
@@ -1,14 +1,149 @@
1
1
  export const unicornRules = {
2
- plugins: [],
2
+ plugins: ['unicorn'],
3
3
  rules: {
4
+ // Enforce a consistent identifier name for catch clause errors
5
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/catch-error-name.html
6
+ // Decision: too prescriptive about local variable naming
7
+ 'unicorn/catch-error-name': 'off',
8
+
9
+ // Enforce passing a message argument to assert functions
10
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-assert.html
11
+ 'unicorn/consistent-assert': 'error',
12
+
13
+ // Prefer `new Date(date)` over `new Date(date.getTime())` for cloning Date objects
14
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-date-clone.html
15
+ 'unicorn/consistent-date-clone': 'error',
16
+
17
+ // Prefer consistent style for spreading empty arrays
18
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-empty-array-spread.html
19
+ 'unicorn/consistent-empty-array-spread': 'error',
20
+
21
+ // Enforce consistent style of `index === -1` for non-existence and `index !== -1` for existence
22
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-existence-index-check.html
23
+ 'unicorn/consistent-existence-index-check': 'error',
24
+
25
+ // Move function declarations to the highest possible scope
26
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-function-scoping.html
27
+ // Decision: too noisy; flags functions that close over locals and would hurt readability if hoisted
28
+ 'unicorn/consistent-function-scoping': 'off',
29
+
30
+ // Enforce consistent escape style in template literals
31
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/consistent-template-literal-escape.html
32
+ 'unicorn/consistent-template-literal-escape': 'error',
33
+
34
+ // Enforce a specific structure for custom error classes
35
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/custom-error-definition.html
36
+ // Decision: too prescriptive about Error subclass shape
37
+ 'unicorn/custom-error-definition': 'off',
38
+
39
+ // Enforce no spaces between braces in empty blocks
40
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/empty-brace-spaces.html
41
+ // Decision: formatter territory
42
+ 'unicorn/empty-brace-spaces': 'off',
43
+
44
+ // Enforce passing a `message` value when creating built-in errors
45
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/error-message.html
46
+ 'unicorn/error-message': 'error',
47
+
48
+ // Require escape sequences to use uppercase or lowercase values
49
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/escape-case.html
50
+ // Decision: formatter territory
51
+ 'unicorn/escape-case': 'off',
52
+
53
+ // Enforce explicitly comparing `length` or `size` property of a value
54
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/explicit-length-check.html
55
+ 'unicorn/explicit-length-check': 'error',
56
+
57
+ // Enforce a case style for filenames
58
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/filename-case.html
59
+ // Decision: project-specific; consumers enforce their own filename conventions
60
+ 'unicorn/filename-case': 'off',
61
+
62
+ // Enforce specific import styles per module
63
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/import-style.html
64
+ 'unicorn/import-style': 'error',
65
+
66
+ // Require `new` when creating an object using a built-in constructor
67
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/new-for-builtins.html
68
+ 'unicorn/new-for-builtins': 'error',
69
+
70
+ // Disallow blanket `eslint-disable` comments
71
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-abusive-eslint-disable.html
72
+ 'unicorn/no-abusive-eslint-disable': 'error',
73
+
74
+ // Disallow accessor properties that recursively call themselves
75
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-accessor-recursion.html
76
+ 'unicorn/no-accessor-recursion': 'error',
77
+
78
+ // Disallow anonymous functions and classes as default exports
79
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-anonymous-default-export.html
80
+ // Decision: anonymous default exports are a common pattern (React components, re-export shims)
81
+ 'unicorn/no-anonymous-default-export': 'off',
82
+
83
+ // Prevent passing a function reference directly to iterator methods (subtle arity/index bugs)
84
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-callback-reference.html
85
+ 'unicorn/no-array-callback-reference': 'error',
86
+
87
+ // Prefer `for...of` over `Array#forEach`
88
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-for-each.html
89
+ // Decision: `Array#forEach` is a legitimate iteration pattern
90
+ 'unicorn/no-array-for-each': 'off',
91
+
92
+ // Disallow using the `this` argument in array methods
93
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-method-this-argument.html
94
+ 'unicorn/no-array-method-this-argument': 'error',
95
+
96
+ // Disallow `Array#reduce()` and `Array#reduceRight()`
97
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-reduce.html
98
+ // Decision: `reduce` is a legitimate functional pattern
99
+ 'unicorn/no-array-reduce': 'off',
100
+
101
+ // Disallow in-place `Array#reverse()` (use `Array#toReversed()`)
102
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-reverse.html
103
+ 'unicorn/no-array-reverse': 'error',
104
+
105
+ // Disallow in-place `Array#sort()` (use `Array#toSorted()`)
106
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-array-sort.html
107
+ 'unicorn/no-array-sort': 'error',
108
+
109
+ // Disallow member access from `await` expressions
110
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-await-expression-member.html
111
+ 'unicorn/no-await-expression-member': 'error',
112
+
4
113
  // Disallow using await in Promise.all/race/etc. array arguments
5
114
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-await-in-promise-methods.html
6
115
  'unicorn/no-await-in-promise-methods': 'error',
7
116
 
117
+ // Do not use leading/trailing space between `console.log` parameters
118
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-console-spaces.html
119
+ // Decision: formatter territory
120
+ 'unicorn/no-console-spaces': 'off',
121
+
122
+ // Disallow direct use of `document.cookie`
123
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-document-cookie.html
124
+ 'unicorn/no-document-cookie': 'error',
125
+
8
126
  // Disallow empty files
9
127
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-empty-file.html
10
128
  'unicorn/no-empty-file': 'error',
11
129
 
130
+ // Enforce the use of Unicode escapes instead of hexadecimal escapes
131
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-hex-escape.html
132
+ // Decision: formatter territory
133
+ 'unicorn/no-hex-escape': 'off',
134
+
135
+ // Disallow `if` statements that always mutate the same variable
136
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-immediate-mutation.html
137
+ 'unicorn/no-immediate-mutation': 'error',
138
+
139
+ // Disallow `instanceof Array` (use `Array.isArray`)
140
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-instanceof-array.html
141
+ 'unicorn/no-instanceof-array': 'error',
142
+
143
+ // Disallow `instanceof` with built-in classes that have safer alternatives
144
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-instanceof-builtins.html
145
+ 'unicorn/no-instanceof-builtins': 'error',
146
+
12
147
  // Disallow invalid options in fetch() calls
13
148
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-invalid-fetch-options.html
14
149
  'unicorn/no-invalid-fetch-options': 'error',
@@ -17,40 +152,411 @@ export const unicornRules = {
17
152
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-invalid-remove-event-listener.html
18
153
  'unicorn/no-invalid-remove-event-listener': 'error',
19
154
 
155
+ // Disallow passing `length` as the `end` argument of `Array#slice()`
156
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-length-as-slice-end.html
157
+ 'unicorn/no-length-as-slice-end': 'error',
158
+
159
+ // Disallow `if` statements as the only statement in `if` blocks without `else`
160
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-lonely-if.html
161
+ // Decision: stylistic; nested `if` sometimes reads better than `else if`
162
+ 'unicorn/no-lonely-if': 'off',
163
+
164
+ // Disallow a magic number as the `depth` argument in `Array#flat()`
165
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-magic-array-flat-depth.html
166
+ 'unicorn/no-magic-array-flat-depth': 'error',
167
+
168
+ // Disallow negated conditions
169
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-negated-condition.html
170
+ // Decision: stylistic; negated conditions are sometimes clearer
171
+ 'unicorn/no-negated-condition': 'off',
172
+
173
+ // Disallow negated expressions on the left of equality checks
174
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-negation-in-equality-check.html
175
+ 'unicorn/no-negation-in-equality-check': 'error',
176
+
177
+ // Disallow nested ternary expressions
178
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-nested-ternary.html
179
+ // Decision: stylistic; formatter handles readability
180
+ 'unicorn/no-nested-ternary': 'off',
181
+
20
182
  // Disallow new Array() (use Array.from or [...] instead)
21
183
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-new-array.html
22
184
  'unicorn/no-new-array': 'error',
23
185
 
186
+ // Disallow `new Buffer()` (deprecated in Node.js)
187
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-new-buffer.html
188
+ 'unicorn/no-new-buffer': 'error',
189
+
190
+ // Disallow the use of the `null` literal
191
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-null.html
192
+ // Decision: null is widely used in JSON, DOM APIs, and library returns; banning is impractical
193
+ 'unicorn/no-null': 'off',
194
+
195
+ // Disallow the use of objects as default parameters
196
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-object-as-default-parameter.html
197
+ 'unicorn/no-object-as-default-parameter': 'error',
198
+
199
+ // Disallow `process.exit()` (use throw)
200
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-process-exit.html
201
+ // Decision: handled by n/no-process-exit which already enforces this with appropriate exemptions
202
+ 'unicorn/no-process-exit': 'off',
203
+
24
204
  // Disallow passing single-element arrays to Promise.all/race/etc.
25
205
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-single-promise-in-promise-methods.html
26
206
  'unicorn/no-single-promise-in-promise-methods': 'error',
27
207
 
208
+ // Disallow classes that only have static members
209
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-static-only-class.html
210
+ 'unicorn/no-static-only-class': 'error',
211
+
28
212
  // Disallow thenable objects (confuses await/Promise behavior)
29
213
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-thenable.html
30
214
  'unicorn/no-thenable': 'error',
31
215
 
216
+ // Disallow assigning `this` to a variable
217
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-this-assignment.html
218
+ 'unicorn/no-this-assignment': 'error',
219
+
220
+ // Disallow comparing with `typeof x === "undefined"`
221
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-typeof-undefined.html
222
+ // Decision: stylistic; both forms are commonly used
223
+ 'unicorn/no-typeof-undefined': 'off',
224
+
225
+ // Disallow unnecessary `depth` argument to `Array#flat()`
226
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-flat-depth.html
227
+ 'unicorn/no-unnecessary-array-flat-depth': 'error',
228
+
229
+ // Disallow unnecessary `count` argument to `Array#splice()`
230
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unnecessary-array-splice-count.html
231
+ 'unicorn/no-unnecessary-array-splice-count': 'error',
232
+
32
233
  // Disallow unnecessary await on non-Promise values
33
234
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unnecessary-await.html
34
235
  'unicorn/no-unnecessary-await': 'error',
35
236
 
237
+ // Disallow unnecessary `end` argument to `String#slice()`
238
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unnecessary-slice-end.html
239
+ 'unicorn/no-unnecessary-slice-end': 'error',
240
+
241
+ // Disallow unreadable array destructuring
242
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unreadable-array-destructuring.html
243
+ // Decision: stylistic
244
+ 'unicorn/no-unreadable-array-destructuring': 'off',
245
+
246
+ // Disallow unreadable IIFEs
247
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-unreadable-iife.html
248
+ // Decision: stylistic
249
+ 'unicorn/no-unreadable-iife': 'off',
250
+
251
+ // Disallow passing single-element collections to functions accepting iterables
252
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-collection-argument.html
253
+ 'unicorn/no-useless-collection-argument': 'error',
254
+
255
+ // Disallow unnecessary `Error.captureStackTrace(...)` calls
256
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-error-capture-stack-trace.html
257
+ 'unicorn/no-useless-error-capture-stack-trace': 'error',
258
+
36
259
  // Disallow useless fallback in spread (e.g. ...obj || {})
37
260
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-fallback-in-spread.html
38
261
  'unicorn/no-useless-fallback-in-spread': 'error',
39
262
 
263
+ // Disallow useless conversion of iterable to array
264
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-iterator-to-array.html
265
+ 'unicorn/no-useless-iterator-to-array': 'error',
266
+
40
267
  // Disallow useless length checks before array operations
41
268
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-length-check.html
42
269
  'unicorn/no-useless-length-check': 'error',
43
270
 
271
+ // Disallow returning/yielding `Promise.resolve` / `Promise.reject` in async functions
272
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-promise-resolve-reject.html
273
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
274
+
44
275
  // Disallow useless spread operators
45
276
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-spread.html
46
277
  'unicorn/no-useless-spread': 'error',
47
278
 
279
+ // Disallow useless `case` in `switch` statements
280
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-switch-case.html
281
+ 'unicorn/no-useless-switch-case': 'error',
282
+
283
+ // Disallow explicit `undefined` arguments and default parameter values
284
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-useless-undefined.html
285
+ // Decision: stylistic; explicit `undefined` is sometimes clearer at call sites
286
+ 'unicorn/no-useless-undefined': 'off',
287
+
288
+ // Disallow number literals with zero fractions or dangling dots
289
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-zero-fractions.html
290
+ // Decision: formatter territory
291
+ 'unicorn/no-zero-fractions': 'off',
292
+
293
+ // Enforce consistent case for number literal prefixes and suffixes
294
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/number-literal-case.html
295
+ // Decision: formatter territory
296
+ 'unicorn/number-literal-case': 'off',
297
+
298
+ // Enforce a style for numeric separators
299
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/numeric-separators-style.html
300
+ // Decision: formatter territory
301
+ 'unicorn/numeric-separators-style': 'off',
302
+
303
+ // Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions
304
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-add-event-listener.html
305
+ 'unicorn/prefer-add-event-listener': 'error',
306
+
307
+ // Prefer `Array#find()` and `Array#findLast()` over the first/last element from `.filter()`
308
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-find.html
309
+ 'unicorn/prefer-array-find': 'error',
310
+
311
+ // Prefer `Array#flat()` over legacy techniques
312
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-flat.html
313
+ 'unicorn/prefer-array-flat': 'error',
314
+
315
+ // Prefer `.flatMap(…)` over `.map(…).flat()`
316
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-flat-map.html
317
+ 'unicorn/prefer-array-flat-map': 'error',
318
+
319
+ // Prefer `Array#indexOf()` over `Array#findIndex()` for primitive equality
320
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-index-of.html
321
+ 'unicorn/prefer-array-index-of': 'error',
322
+
323
+ // Prefer `.some(…)` over `.find(…)`/`.findIndex(…)`/etc. for boolean checks
324
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-array-some.html
325
+ 'unicorn/prefer-array-some': 'error',
326
+
327
+ // Prefer `.at(…)` for index access
328
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-at.html
329
+ 'unicorn/prefer-at': 'error',
330
+
331
+ // Prefer BigInt literals over `BigInt()`
332
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-bigint-literals.html
333
+ 'unicorn/prefer-bigint-literals': 'error',
334
+
335
+ // Prefer `Blob#text()` / `Blob#bytes()` over `FileReader#readAs*`
336
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-blob-reading-methods.html
337
+ 'unicorn/prefer-blob-reading-methods': 'error',
338
+
339
+ // Prefer class field declarations over assigning in the constructor
340
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-class-fields.html
341
+ 'unicorn/prefer-class-fields': 'error',
342
+
343
+ // Prefer `.classList.toggle()` over manual class toggling
344
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-classlist-toggle.html
345
+ 'unicorn/prefer-classlist-toggle': 'error',
346
+
347
+ // Prefer `String#codePointAt(…)` over `String#charCodeAt(…)`
348
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-code-point.html
349
+ 'unicorn/prefer-code-point': 'error',
350
+
351
+ // Prefer `Date.now()` over `new Date().getTime()`
352
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-date-now.html
353
+ 'unicorn/prefer-date-now': 'error',
354
+
355
+ // Prefer default parameters over reassignment
356
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-default-parameters.html
357
+ 'unicorn/prefer-default-parameters': 'error',
358
+
359
+ // Prefer `Node#append()` over `Node#appendChild()`
360
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-append.html
361
+ 'unicorn/prefer-dom-node-append': 'error',
362
+
363
+ // Prefer using `.dataset` on DOM nodes over `.setAttribute(…)`
364
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-dataset.html
365
+ 'unicorn/prefer-dom-node-dataset': 'error',
366
+
367
+ // Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`
368
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-remove.html
369
+ 'unicorn/prefer-dom-node-remove': 'error',
370
+
371
+ // Prefer `.textContent` over `.innerText`
372
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-dom-node-text-content.html
373
+ 'unicorn/prefer-dom-node-text-content': 'error',
374
+
375
+ // Prefer `EventTarget` over `EventEmitter`
376
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-event-target.html
377
+ // Decision: EventTarget vs EventEmitter is architectural; let consumers choose
378
+ 'unicorn/prefer-event-target': 'off',
379
+
380
+ // Prefer `globalThis` over `window` / `self` / `global`
381
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-global-this.html
382
+ 'unicorn/prefer-global-this': 'error',
383
+
384
+ // Prefer `import.meta.{dirname,filename}` over CJS-equivalent constructions
385
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-import-meta-properties.html
386
+ 'unicorn/prefer-import-meta-properties': 'error',
387
+
388
+ // Prefer `.includes(…)` over `.indexOf(…) !== -1`
389
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-includes.html
390
+ 'unicorn/prefer-includes': 'error',
391
+
392
+ // Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`
393
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-keyboard-event-key.html
394
+ 'unicorn/prefer-keyboard-event-key': 'error',
395
+
396
+ // Prefer logical operators (`||`/`??`) over ternaries for fallbacks
397
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-logical-operator-over-ternary.html
398
+ 'unicorn/prefer-logical-operator-over-ternary': 'error',
399
+
400
+ // Prefer `Math.min()` / `Math.max()` over ternary expressions
401
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-math-min-max.html
402
+ 'unicorn/prefer-math-min-max': 'error',
403
+
404
+ // Prefer `Math.trunc(…)` over bitwise integer truncation
405
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-math-trunc.html
406
+ 'unicorn/prefer-math-trunc': 'error',
407
+
408
+ // Prefer modern DOM APIs (e.g. `Element#replaceWith()`)
409
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-modern-dom-apis.html
410
+ 'unicorn/prefer-modern-dom-apis': 'error',
411
+
412
+ // Prefer modern `Math` methods (e.g. `Math.log2`, `Math.cbrt`, …)
413
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-modern-math-apis.html
414
+ 'unicorn/prefer-modern-math-apis': 'error',
415
+
416
+ // Prefer ESM over CommonJS
417
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-module.html
418
+ // Decision: consumers may still ship CommonJS; let them opt in via their own config
419
+ 'unicorn/prefer-module': 'off',
420
+
421
+ // Prefer native coercion functions (e.g. `Boolean(value)` over `!!value`)
422
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-native-coercion-functions.html
423
+ 'unicorn/prefer-native-coercion-functions': 'error',
424
+
425
+ // Prefer negative index over `.length - x` in `.slice()` and `.at()`
426
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-negative-index.html
427
+ 'unicorn/prefer-negative-index': 'error',
428
+
429
+ // Prefer using the `node:` protocol when importing Node.js builtins
430
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-node-protocol.html
431
+ 'unicorn/prefer-node-protocol': 'error',
432
+
433
+ // Prefer `Number.parseInt()` / `Number.parseFloat()` / `Number.isNaN()` over their global counterparts
434
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-number-properties.html
435
+ 'unicorn/prefer-number-properties': 'error',
436
+
437
+ // Prefer `Object.fromEntries(…)` over building objects via `.reduce(…)`
438
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-object-from-entries.html
439
+ 'unicorn/prefer-object-from-entries': 'error',
440
+
441
+ // Prefer omitting the catch binding parameter when unused
442
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-optional-catch-binding.html
443
+ 'unicorn/prefer-optional-catch-binding': 'error',
444
+
445
+ // Prefer borrowing methods from the prototype instead of an instance
446
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-prototype-methods.html
447
+ 'unicorn/prefer-prototype-methods': 'error',
448
+
449
+ // Prefer `.querySelector(…)` over `.getElementById(…)` / `.getElementsByClassName(…)`
450
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-query-selector.html
451
+ // Decision: `getElementById` is the standard fast path; not worth refactoring away
452
+ 'unicorn/prefer-query-selector': 'off',
453
+
454
+ // Prefer `Reflect.apply(…)` over `Function.prototype.apply.call(…)`
455
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-reflect-apply.html
456
+ 'unicorn/prefer-reflect-apply': 'error',
457
+
458
+ // Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()` for booleans
459
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-regexp-test.html
460
+ 'unicorn/prefer-regexp-test': 'error',
461
+
462
+ // Prefer `Response.json(…)` over `new Response(JSON.stringify(…))`
463
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-response-static-json.html
464
+ 'unicorn/prefer-response-static-json': 'error',
465
+
466
+ // Prefer `Set#has(…)` over `Array#includes(…)` when membership checks repeat
467
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-set-has.html
468
+ 'unicorn/prefer-set-has': 'error',
469
+
48
470
  // Prefer Set#size over converting to array and checking length
49
471
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-set-size.html
50
472
  'unicorn/prefer-set-size': 'error',
51
473
 
474
+ // Prefer the spread operator over `Array.from(…)` etc.
475
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-spread.html
476
+ 'unicorn/prefer-spread': 'error',
477
+
478
+ // Prefer `String.raw(…)` over manually escaped strings
479
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-string-raw.html
480
+ // Decision: `String.raw` is niche and easy to misread
481
+ 'unicorn/prefer-string-raw': 'off',
482
+
483
+ // Prefer `String#replaceAll(…)` over global regex replace
484
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-string-replace-all.html
485
+ 'unicorn/prefer-string-replace-all': 'error',
486
+
487
+ // Prefer `String#slice(…)` over deprecated `substr`/`substring`
488
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-string-slice.html
489
+ 'unicorn/prefer-string-slice': 'error',
490
+
52
491
  // Prefer String#startsWith/endsWith over regex or slice comparisons
53
492
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-string-starts-ends-with.html
54
493
  'unicorn/prefer-string-starts-ends-with': 'error',
494
+
495
+ // Prefer `String#trimStart()`/`trimEnd()` over deprecated `trimLeft()`/`trimRight()`
496
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-string-trim-start-end.html
497
+ 'unicorn/prefer-string-trim-start-end': 'error',
498
+
499
+ // Prefer `structuredClone(…)` over `JSON.parse(JSON.stringify(…))`
500
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-structured-clone.html
501
+ 'unicorn/prefer-structured-clone': 'error',
502
+
503
+ // Prefer ternary expressions over short `if-else` returns/assignments
504
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-ternary.html
505
+ // Decision: stylistic; clarity over compactness
506
+ 'unicorn/prefer-ternary': 'off',
507
+
508
+ // Prefer top-level `await` over wrapping module entrypoints in async IIFEs
509
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-top-level-await.html
510
+ // Decision: not all consumer modules support TLA; opt-in per consumer
511
+ 'unicorn/prefer-top-level-await': 'off',
512
+
513
+ // Enforce `throw new TypeError(…)` for type-related errors
514
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-type-error.html
515
+ 'unicorn/prefer-type-error': 'error',
516
+
517
+ // Enforce a consistent style for `./` prefixes in relative URLs
518
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/relative-url-style.html
519
+ // Decision: stylistic; both forms are widely used
520
+ 'unicorn/relative-url-style': 'off',
521
+
522
+ // Require explicit separator argument for `Array#join(…)`
523
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/require-array-join-separator.html
524
+ // Decision: the default `,` separator is widely understood; explicit argument is noise
525
+ 'unicorn/require-array-join-separator': 'off',
526
+
527
+ // Require import attributes for non-JS module imports (JSON modules etc.)
528
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/require-module-attributes.html
529
+ 'unicorn/require-module-attributes': 'error',
530
+
531
+ // Require one module specifier per `import` declaration
532
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/require-module-specifiers.html
533
+ 'unicorn/require-module-specifiers': 'error',
534
+
535
+ // Require explicit `digits` argument for `Number#toFixed(…)`
536
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/require-number-to-fixed-digits-argument.html
537
+ 'unicorn/require-number-to-fixed-digits-argument': 'error',
538
+
539
+ // Require explicit `targetOrigin` for `window.postMessage(…)`
540
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/require-post-message-target-origin.html
541
+ 'unicorn/require-post-message-target-origin': 'error',
542
+
543
+ // Enforce consistent brace style for switch cases
544
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/switch-case-braces.html
545
+ // Decision: formatter territory
546
+ 'unicorn/switch-case-braces': 'off',
547
+
548
+ // Enforce consistent break position in switch cases
549
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/switch-case-break-position.html
550
+ // Decision: formatter territory
551
+ 'unicorn/switch-case-break-position': 'off',
552
+
553
+ // Enforce consistent case for text encoding identifiers (e.g. `'utf-8'` vs `'utf8'`)
554
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/text-encoding-identifier-case.html
555
+ // Decision: both spellings are universally accepted by APIs
556
+ 'unicorn/text-encoding-identifier-case': 'off',
557
+
558
+ // Require `new` when throwing built-in errors
559
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/throw-new-error.html
560
+ 'unicorn/throw-new-error': 'error',
55
561
  },
56
562
  };
package/rules/vitest.mjs CHANGED
@@ -32,8 +32,7 @@ export const vitestRules = {
32
32
 
33
33
  // Enforce padding around afterAll blocks
34
34
  // https://oxc.rs/docs/guide/usage/linter/rules/vitest/padding-around-after-all-blocks.html
35
- // Decision: stylistic formatting rule, left to formatter
36
- 'vitest/padding-around-after-all-blocks': 'off',
35
+ 'vitest/padding-around-after-all-blocks': 'error',
37
36
 
38
37
  // Disallow conditional tests
39
38
  // https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-conditional-in-test.html
@@ -335,7 +334,8 @@ export const vitestRules = {
335
334
 
336
335
  // Enforce padding around afterAll blocks
337
336
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
338
- 'vitest-js/padding-around-after-all-blocks': 'error',
337
+ // Decision: handled by native vitest/padding-around-after-all-blocks
338
+ 'vitest-js/padding-around-after-all-blocks': 'off',
339
339
 
340
340
  // Enforce padding around afterEach blocks
341
341
  // https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-each-blocks.md