chore(site): add react-you-might-not-need-an-effect oxlint plugin (#32565)
Adds [eslint-plugin-react-you-might-not-need-an-effect](https://github.com/nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect) to oxlint through `jsPlugins` and enables `no-pass-live-state-to-parent`, the only rule with no existing violations. The other eight rules go into the migration backlog as `"off"`. Follow-up PRs enable them one at a time, smallest first, and fix their violations. Oxlint runs the plugin itself, so `packageExtensions` marks the plugin's `eslint` peer as optional. This keeps `eslint` out of the install, the same way `@shadcn/lint` declares it. The plugin is added to knip's `ignoreDependencies` for the same reason as `@shadcn/lint`: it is referenced only from the oxlint config. <details> <summary>Rollout plan</summary> Violation counts with every rule enabled (153 total): | Rule | Findings | Files | |---|---|---| | `no-pass-live-state-to-parent` | 0 | 0 | | `no-reset-all-state-on-prop-change` | 3 | 3 | | `no-external-store-subscription` | 6 | 5 | | `no-derived-state` | 8 | 5 | | `no-chain-state-updates` | 8 | 6 | | `no-initialize-state` | 8 | 6 | | `no-pass-data-to-parent` | 10 | 5 | | `no-adjust-state-on-prop-change` | 26 | 19 | | `no-event-handler` | 84 | 37 | 1. This PR: plugin setup and the zero-violation rule. 2. One stacked PR per remaining rule, in the order above, each moving its rule from the backlog to `"error"` and fixing its violations. Counts are rechecked after each PR because one rule's fixes can change another rule's findings. </details> > Generated by Coder Agents on behalf of @DanielleMaywood.
This commit is contained in:
1 parent
1cd23eb039
commit
b4cae68207
5 files changed
+39
No files matched your search
@@ -15,6 +15,7 @@
|
||||
"@shadcn/lint",
|
||||
"@tailwindcss/typography",
|
||||
"@types/react-virtualized-auto-sizer",
|
||||
"eslint-plugin-react-you-might-not-need-an-effect",
|
||||
"tailwindcss",
|
||||
"tw-animate-css",
|
||||
"ts-proto"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["typescript", "unicorn", "oxc", "react", "jsx-a11y", "vitest"],
|
||||
"jsPlugins": ["eslint-plugin-react-you-might-not-need-an-effect"],
|
||||
"rules": {
|
||||
// --- a11y (jsx-a11y) ---
|
||||
"no-access-key": "error",
|
||||
@@ -207,6 +208,9 @@
|
||||
{ "functions": false, "classes": false, "variables": false }
|
||||
],
|
||||
|
||||
// --- react-you-might-not-need-an-effect ---
|
||||
"react-you-might-not-need-an-effect/no-pass-live-state-to-parent": "error",
|
||||
|
||||
// ==========================================================
|
||||
// Migration backlog (temporary; shrinks as we go).
|
||||
// Each rule maps to a Biome rule, but oxlint's implementation
|
||||
@@ -240,6 +244,16 @@
|
||||
"vitest/valid-expect": "off", // (small)
|
||||
"purity": "off", // (small)
|
||||
|
||||
// react-you-might-not-need-an-effect rules with existing violations.
|
||||
"react-you-might-not-need-an-effect/no-event-handler": "off", // (xl)
|
||||
"react-you-might-not-need-an-effect/no-adjust-state-on-prop-change": "off", // (large)
|
||||
"react-you-might-not-need-an-effect/no-pass-data-to-parent": "off", // (medium)
|
||||
"react-you-might-not-need-an-effect/no-initialize-state": "off", // (medium)
|
||||
"react-you-might-not-need-an-effect/no-chain-state-updates": "off", // (medium)
|
||||
"react-you-might-not-need-an-effect/no-derived-state": "off", // (medium)
|
||||
"react-you-might-not-need-an-effect/no-external-store-subscription": "off", // (small)
|
||||
"react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change": "off", // (small)
|
||||
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
"babel-plugin-react-compiler": "1.0.0",
|
||||
"dpdm": "3.15.1",
|
||||
"emojibase": "17.0.0",
|
||||
"eslint-plugin-react-you-might-not-need-an-effect": "1.2.0",
|
||||
"express": "4.22.3",
|
||||
"jest-canvas-mock": "2.5.2",
|
||||
"jest-websocket-mock": "2.5.0",
|
||||
|
||||
Generated
+16
@@ -172,6 +172,8 @@ overrides:
|
||||
brace-expansion@<2: 1.1.21
|
||||
minimatch@>=10: 11.0.1
|
||||
|
||||
packageExtensionsChecksum: sha256-KJ5S0mcdz92ou1yEBoRPMk7tFYXOsL0VDXlqdmR0uXs=
|
||||
|
||||
patchedDependencies:
|
||||
cmdk@1.1.1: 1fd7e2e50791a6122cefa7103f66878943a4d18d434ebc6d1035e736e538caa5
|
||||
|
||||
@@ -528,6 +530,9 @@ importers:
|
||||
emojibase:
|
||||
specifier: 17.0.0
|
||||
version: 17.0.0
|
||||
eslint-plugin-react-you-might-not-need-an-effect:
|
||||
specifier: 1.2.0
|
||||
version: 1.2.0
|
||||
express:
|
||||
specifier: 4.22.3
|
||||
version: 4.22.3(supports-color@7.2.0)
|
||||
@@ -4502,6 +4507,15 @@ packages:
|
||||
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==, tarball: https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
eslint-plugin-react-you-might-not-need-an-effect@1.2.0:
|
||||
resolution: {integrity: sha512-ieSAjWnVO92c2kyDPYgGJplcX1Fs4dhCmbEVgM9PMJ3Kg0mE9BBacT7HQRyKqrhaxVyneiIlA8BsY7vzF+bQ4A==, tarball: https://registry.npmjs.org/eslint-plugin-react-you-might-not-need-an-effect/-/eslint-plugin-react-you-might-not-need-an-effect-1.2.0.tgz}
|
||||
engines: {node: '>=14.0.0'}
|
||||
peerDependencies:
|
||||
eslint: '>=8.40.0'
|
||||
peerDependenciesMeta:
|
||||
eslint:
|
||||
optional: true
|
||||
|
||||
esm-env@1.2.2:
|
||||
resolution: {integrity: sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==, tarball: https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz}
|
||||
|
||||
@@ -10783,6 +10797,8 @@ snapshots:
|
||||
|
||||
escape-string-regexp@5.0.0: {}
|
||||
|
||||
eslint-plugin-react-you-might-not-need-an-effect@1.2.0: {}
|
||||
|
||||
esm-env@1.2.2: {}
|
||||
|
||||
esprima@4.0.1: {}
|
||||
|
||||
@@ -25,3 +25,10 @@ allowBuilds:
|
||||
|
||||
patchedDependencies:
|
||||
cmdk@1.1.1: patches/cmdk@1.1.1.patch
|
||||
|
||||
# Oxlint loads these ESLint plugins through jsPlugins, so the eslint peer is not needed.
|
||||
packageExtensions:
|
||||
eslint-plugin-react-you-might-not-need-an-effect:
|
||||
peerDependenciesMeta:
|
||||
eslint:
|
||||
optional: true
|
||||
Reference in new issue
Block a user