oxlint-plugin-react-doctor 0.2.0 → 0.2.2
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/README.md +30 -2
- package/dist/index.d.ts +6863 -1674
- package/dist/index.js +30429 -9348
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
[oxlint](https://oxc.rs/docs/guide/usage/linter) plugin for [React Doctor](https://react.doctor). Diagnoses React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues.
|
|
7
7
|
|
|
8
|
-
This package owns the rule implementations (
|
|
8
|
+
This package owns the rule implementations (287 rules across architecture, performance, correctness, security, accessibility, bundle-size, framework-specific, `react-builtins`, and `a11y` buckets). [`eslint-plugin-react-doctor`](https://npmjs.com/package/eslint-plugin-react-doctor) wraps these same rules for ESLint, and the full diagnostic CLI lives in [`react-doctor`](https://npmjs.com/package/react-doctor).
|
|
9
|
+
|
|
10
|
+
### Ported OXC react + jsx-a11y rules
|
|
11
|
+
|
|
12
|
+
The `react-builtins/` and `a11y/` buckets contain 100 rules ported from
|
|
13
|
+
[`oxc-project/oxc`](https://github.com/oxc-project/oxc)'s
|
|
14
|
+
`crates/oxc_linter/src/rules/{react,react_perf,jsx_a11y}/`. They cover
|
|
15
|
+
every rule React Doctor previously consumed via oxlint's built-in
|
|
16
|
+
`react/*` and `jsx-a11y/*` plugins (now sourced natively as
|
|
17
|
+
`react-doctor/*`), including `react/rules-of-hooks` and
|
|
18
|
+
`react/exhaustive-deps`, which run on top of a TS port of OXC's scope
|
|
19
|
+
analysis + control-flow-graph layer.
|
|
9
20
|
|
|
10
21
|
## Install
|
|
11
22
|
|
|
@@ -43,7 +54,7 @@ npx oxlint .
|
|
|
43
54
|
|
|
44
55
|
## Available rules
|
|
45
56
|
|
|
46
|
-
The full rule list lives in [`
|
|
57
|
+
The full rule list lives in [`rule-registry.ts`](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rule-registry.ts). All rules are namespaced under `react-doctor/*`.
|
|
47
58
|
|
|
48
59
|
Each rule can be set to `"error"`, `"warn"`, or `"off"`:
|
|
49
60
|
|
|
@@ -56,6 +67,23 @@ Each rule can be set to `"error"`, `"warn"`, or `"off"`:
|
|
|
56
67
|
}
|
|
57
68
|
```
|
|
58
69
|
|
|
70
|
+
## "You Might Not Need an Effect" rule family
|
|
71
|
+
|
|
72
|
+
Eight rules ported 1:1 from [`eslint-plugin-react-you-might-not-need-an-effect`](https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect) (MIT, NickvanDyke) ship natively in this package — same rule IDs, same diagnostic messages, same semantics (195 of 196 upstream test cases pass; the remaining one is upstream's own `todo: true`). Attribution and known divergences live in [`SOURCE.md`](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rules/state-and-effects/effect/SOURCE.md).
|
|
73
|
+
|
|
74
|
+
| Rule | What it catches |
|
|
75
|
+
| ------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
76
|
+
| `react-doctor/no-derived-state` | Storing derived state via `useEffect` instead of computing during render |
|
|
77
|
+
| `react-doctor/no-chain-state-updates` | Chaining state updates across effects |
|
|
78
|
+
| `react-doctor/no-event-handler` | Using state + a guarded effect as an event handler |
|
|
79
|
+
| `react-doctor/no-adjust-state-on-prop-change` | Adjusting state in an effect when a prop changes |
|
|
80
|
+
| `react-doctor/no-reset-all-state-on-prop-change` | Resetting all state in an effect (use a `key` prop instead) |
|
|
81
|
+
| `react-doctor/no-pass-live-state-to-parent` | Pushing live state to a parent via a callback in an effect |
|
|
82
|
+
| `react-doctor/no-pass-data-to-parent` | Passing fetched data to a parent via a callback in an effect |
|
|
83
|
+
| `react-doctor/no-initialize-state` | Initializing state inside a mount-only effect (pass it to `useState` instead) |
|
|
84
|
+
|
|
85
|
+
If you previously enabled them as `effect/*` via the optional peer dep, drop the peer dep — they're enabled by default through React Doctor's CLI config now.
|
|
86
|
+
|
|
59
87
|
## Want the CLI too?
|
|
60
88
|
|
|
61
89
|
This package only ships the oxlint plugin. To run React Doctor's full scan (with scoring, JSON reports, agent integration, etc.), use the main CLI:
|