@wistia/oxlint-config 1.11.2 → 1.12.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/CHANGELOG.md +21 -0
- package/package.json +5 -5
- package/rules/react.mjs +118 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @wistia/oxlint-config
|
|
2
2
|
|
|
3
|
+
## 1.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#179](https://github.com/wistia/oxlint-config/pull/179) [`2cb8282`](https://github.com/wistia/oxlint-config/commit/2cb8282f1660a8c2b211ef86d7cbb9249500a1ec) Thanks [@okize](https://github.com/okize)! - feat: configure the React Compiler rule split from oxlint v1.79.0
|
|
8
|
+
|
|
9
|
+
- Bump `oxlint` peer minimum to `>= 1.79.0` and `oxfmt` peer minimum to `>= 0.64.0`
|
|
10
|
+
- oxlint v1.79.0 removes `react/react-compiler` (previously `error`) and splits it into 22 per-category React Compiler rules. All 22 are now configured:
|
|
11
|
+
- `error` — the upstream `recommended` preset: `react/error-boundaries`, `react/globals`, `react/immutability`, `react/incompatible-library`, `react/preserve-manual-memoization`, `react/purity`, `react/refs`, `react/set-state-in-effect`, `react/set-state-in-render`, `react/static-components`, `react/unsupported-syntax`, `react/use-memo`, `react/void-use-memo`
|
|
12
|
+
- `off` — duplicate existing native coverage: `react/hooks` (handled by `react/rules-of-hooks`), `react/exhaustive-effect-dependencies` and `react/memo-dependencies` (handled by `react/exhaustive-deps`)
|
|
13
|
+
- `off` — report compiler status rather than code defects: `react/invariant`, `react/todo`, `react/syntax`
|
|
14
|
+
- `off` — upstream keeps these off; revisit if the React Compiler transform is adopted: `react/no-deriving-state-in-effects`, `react/rule-suppression`, `react/capitalized-calls`
|
|
15
|
+
- Ten `@eslint-react` jsPlugin rules superseded by the new native rules flip from `error` to `off`: `error-boundaries`, `globals`, `immutability`, `purity`, `refs`, `set-state-in-effect`, `set-state-in-render`, `static-components`, `unsupported-syntax`, `use-memo`
|
|
16
|
+
- Behavior changes in v1.79.0 to rules already set to `error`, no config change required:
|
|
17
|
+
- `eslint/no-irregular-whitespace` now checks comments by default
|
|
18
|
+
- `eslint/no-redeclare` now runs in ES modules, skipping only the globals check
|
|
19
|
+
- `import/no-named-as-default` now reports local export conflicts
|
|
20
|
+
- `import/no-named-default` now flags type-only named defaults
|
|
21
|
+
- `react/rules-of-hooks` now reports hooks inside `try` blocks
|
|
22
|
+
- `react/exhaustive-deps` now handles destructured object dependencies
|
|
23
|
+
|
|
3
24
|
## 1.11.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/oxlint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Wistia's Oxlint configurations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"linter",
|
|
@@ -95,16 +95,16 @@
|
|
|
95
95
|
"@changesets/changelog-github": "^1.0.0",
|
|
96
96
|
"@changesets/cli": "^3.0.0",
|
|
97
97
|
"eslint": "^10.8.0",
|
|
98
|
-
"oxfmt": "^0.
|
|
99
|
-
"oxlint": "^1.
|
|
98
|
+
"oxfmt": "^0.64.0",
|
|
99
|
+
"oxlint": "^1.79.0",
|
|
100
100
|
"oxlint-tsgolint": "^7.0.2001",
|
|
101
101
|
"storybook": "^10.5.5",
|
|
102
102
|
"vitest": "^4.1.10"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"eslint": ">= 10.8.0",
|
|
106
|
-
"oxfmt": ">= 0.
|
|
107
|
-
"oxlint": ">= 1.
|
|
106
|
+
"oxfmt": ">= 0.64.0",
|
|
107
|
+
"oxlint": ">= 1.79.0",
|
|
108
108
|
"oxlint-tsgolint": ">= 7.0.2001"
|
|
109
109
|
},
|
|
110
110
|
"peerDependenciesMeta": {
|
package/rules/react.mjs
CHANGED
|
@@ -279,9 +279,104 @@ export const reactRules = {
|
|
|
279
279
|
// Decision: too opinionated for general use
|
|
280
280
|
'react/state-in-constructor': 'off',
|
|
281
281
|
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
// --- React Compiler rules ---
|
|
283
|
+
|
|
284
|
+
// Validate usage of Error Boundaries instead of try/catch for child errors
|
|
285
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/error-boundaries.html
|
|
286
|
+
'react/error-boundaries': 'error',
|
|
287
|
+
|
|
288
|
+
// Restrict reading or writing mutable globals during render
|
|
289
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/globals.html
|
|
290
|
+
'react/globals': 'error',
|
|
291
|
+
|
|
292
|
+
// Disallow mutating props, state, and other immutable values
|
|
293
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/immutability.html
|
|
294
|
+
'react/immutability': 'error',
|
|
295
|
+
|
|
296
|
+
// Flag library APIs known to be incompatible with memoization
|
|
297
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/incompatible-library.html
|
|
298
|
+
'react/incompatible-library': 'error',
|
|
299
|
+
|
|
300
|
+
// Ensure the compiler's inferred dependencies preserve existing manual memoization
|
|
301
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/preserve-manual-memoization.html
|
|
302
|
+
'react/preserve-manual-memoization': 'error',
|
|
303
|
+
|
|
304
|
+
// Validate that components and hooks are pure
|
|
305
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/purity.html
|
|
306
|
+
'react/purity': 'error',
|
|
307
|
+
|
|
308
|
+
// Validate that refs are not read or written during render
|
|
309
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/refs.html
|
|
310
|
+
'react/refs': 'error',
|
|
311
|
+
|
|
312
|
+
// Disallow calling setState synchronously in an effect
|
|
313
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/set-state-in-effect.html
|
|
314
|
+
'react/set-state-in-effect': 'error',
|
|
315
|
+
|
|
316
|
+
// Disallow setting state during render
|
|
317
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/set-state-in-render.html
|
|
318
|
+
'react/set-state-in-render': 'error',
|
|
319
|
+
|
|
320
|
+
// Enforce static component definitions
|
|
321
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/static-components.html
|
|
322
|
+
'react/static-components': 'error',
|
|
323
|
+
|
|
324
|
+
// Disallow syntax that React does not support
|
|
325
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/unsupported-syntax.html
|
|
326
|
+
'react/unsupported-syntax': 'error',
|
|
327
|
+
|
|
328
|
+
// Validate that useMemo callbacks return a value
|
|
329
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/use-memo.html
|
|
330
|
+
'react/use-memo': 'error',
|
|
331
|
+
|
|
332
|
+
// Validate that useMemo results are actually used
|
|
333
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/void-use-memo.html
|
|
334
|
+
'react/void-use-memo': 'error',
|
|
335
|
+
|
|
336
|
+
// Compiler-powered Rules of Hooks validation
|
|
337
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/hooks.html
|
|
338
|
+
// Decision: handled by native react/rules-of-hooks
|
|
339
|
+
'react/hooks': 'off',
|
|
340
|
+
|
|
341
|
+
// Validate effect dependency arrays are exhaustive without extraneous values
|
|
342
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/exhaustive-effect-dependencies.html
|
|
343
|
+
// Decision: handled by native react/exhaustive-deps
|
|
344
|
+
'react/exhaustive-effect-dependencies': 'off',
|
|
345
|
+
|
|
346
|
+
// Validate useMemo/useCallback dependency lists
|
|
347
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/memo-dependencies.html
|
|
348
|
+
// Decision: handled by native react/exhaustive-deps
|
|
349
|
+
'react/memo-dependencies': 'off',
|
|
350
|
+
|
|
351
|
+
// Report internal React Compiler invariant violations
|
|
352
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/invariant.html
|
|
353
|
+
// Decision: reports bugs in the compiler itself, not code defects
|
|
354
|
+
'react/invariant': 'off',
|
|
355
|
+
|
|
356
|
+
// Report code the React Compiler cannot analyze yet
|
|
357
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/todo.html
|
|
358
|
+
// Decision: reports compiler bail-outs, not code defects
|
|
359
|
+
'react/todo': 'off',
|
|
360
|
+
|
|
361
|
+
// Report invalid JavaScript the compiler encountered (e.g. const reassignment)
|
|
362
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/syntax.html
|
|
363
|
+
// Decision: invalid JS is already reported by base eslint rules like no-const-assign
|
|
364
|
+
'react/syntax': 'off',
|
|
365
|
+
|
|
366
|
+
// Disallow deriving values from state inside an effect and storing them back into state
|
|
367
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/no-deriving-state-in-effects.html
|
|
368
|
+
// Decision: upstream preset keeps this off; enable if we adopt the React Compiler
|
|
369
|
+
'react/no-deriving-state-in-effects': 'off',
|
|
370
|
+
|
|
371
|
+
// Report suppressions of React rules inside components (compiler skips those functions)
|
|
372
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/rule-suppression.html
|
|
373
|
+
// Decision: upstream preset keeps this off; enable if we adopt the React Compiler
|
|
374
|
+
'react/rule-suppression': 'off',
|
|
375
|
+
|
|
376
|
+
// Disallow calling capitalized functions directly during render
|
|
377
|
+
// https://oxc.rs/docs/guide/usage/linter/rules/react/capitalized-calls.html
|
|
378
|
+
// Decision: upstream preset keeps this off; enable if we adopt the React Compiler
|
|
379
|
+
'react/capitalized-calls': 'off',
|
|
285
380
|
|
|
286
381
|
// Disallow string literals in JSX
|
|
287
382
|
// https://oxc.rs/docs/guide/usage/linter/rules/react/jsx-no-literals.html
|
|
@@ -292,11 +387,13 @@ export const reactRules = {
|
|
|
292
387
|
|
|
293
388
|
// Validates usage of Error Boundaries instead of try/catch for child errors
|
|
294
389
|
// https://eslint-react.xyz/docs/rules/error-boundaries
|
|
295
|
-
|
|
390
|
+
// Decision: handled by native react/error-boundaries
|
|
391
|
+
'@eslint-react/error-boundaries': 'off',
|
|
296
392
|
|
|
297
393
|
// Restricts usage of global variables in React components
|
|
298
394
|
// https://eslint-react.xyz/docs/rules/globals
|
|
299
|
-
|
|
395
|
+
// Decision: handled by native react/globals
|
|
396
|
+
'@eslint-react/globals': 'off',
|
|
300
397
|
|
|
301
398
|
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
302
399
|
// https://eslint-react.xyz/docs/rules/exhaustive-deps
|
|
@@ -305,7 +402,8 @@ export const reactRules = {
|
|
|
305
402
|
|
|
306
403
|
// Validates against mutating props, state, and other immutable values
|
|
307
404
|
// https://eslint-react.xyz/docs/rules/immutability
|
|
308
|
-
|
|
405
|
+
// Decision: handled by native react/immutability
|
|
406
|
+
'@eslint-react/immutability': 'off',
|
|
309
407
|
|
|
310
408
|
// Prevent accidental JS comments from being injected into JSX as text
|
|
311
409
|
// https://eslint-react.xyz/docs/rules/jsx-no-comment-textnodes
|
|
@@ -520,11 +618,13 @@ export const reactRules = {
|
|
|
520
618
|
|
|
521
619
|
// Validates that components/hooks are pure
|
|
522
620
|
// https://eslint-react.xyz/docs/rules/purity
|
|
523
|
-
|
|
621
|
+
// Decision: handled by native react/purity
|
|
622
|
+
'@eslint-react/purity': 'off',
|
|
524
623
|
|
|
525
624
|
// Validates correct usage of refs, not reading/writing during render
|
|
526
625
|
// https://eslint-react.xyz/docs/rules/refs
|
|
527
|
-
|
|
626
|
+
// Decision: handled by native react/refs
|
|
627
|
+
'@eslint-react/refs': 'off',
|
|
528
628
|
|
|
529
629
|
// Enforce Rules of Hooks
|
|
530
630
|
// https://eslint-react.xyz/docs/rules/rules-of-hooks
|
|
@@ -533,23 +633,28 @@ export const reactRules = {
|
|
|
533
633
|
|
|
534
634
|
// Validates against calling setState synchronously in an effect
|
|
535
635
|
// https://eslint-react.xyz/docs/rules/set-state-in-effect
|
|
536
|
-
|
|
636
|
+
// Decision: handled by native react/set-state-in-effect
|
|
637
|
+
'@eslint-react/set-state-in-effect': 'off',
|
|
537
638
|
|
|
538
639
|
// Validates against setting state during render
|
|
539
640
|
// https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
540
|
-
|
|
641
|
+
// Decision: handled by native react/set-state-in-render
|
|
642
|
+
'@eslint-react/set-state-in-render': 'off',
|
|
541
643
|
|
|
542
644
|
// Enforces static component definitions
|
|
543
645
|
// https://eslint-react.xyz/docs/rules/static-components
|
|
544
|
-
|
|
646
|
+
// Decision: handled by native react/static-components
|
|
647
|
+
'@eslint-react/static-components': 'off',
|
|
545
648
|
|
|
546
649
|
// Validates against syntax that React does not support
|
|
547
650
|
// https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
548
|
-
|
|
651
|
+
// Decision: handled by native react/unsupported-syntax
|
|
652
|
+
'@eslint-react/unsupported-syntax': 'off',
|
|
549
653
|
|
|
550
654
|
// Validates usage of useMemo with a return value
|
|
551
655
|
// https://eslint-react.xyz/docs/rules/use-memo
|
|
552
|
-
|
|
656
|
+
// Decision: handled by native react/use-memo
|
|
657
|
+
'@eslint-react/use-memo': 'off',
|
|
553
658
|
|
|
554
659
|
// Ensure destructuring and symmetric naming of useState hook value and setter
|
|
555
660
|
// https://eslint-react.xyz/docs/rules/use-state
|