From b4cae68207fccb8febb949da17d7cb3ccc540ba0 Mon Sep 17 00:00:00 2001 From: Danielle Maywood Date: Wed, 25 Nov 2026 13:24:10 +0000 Subject: [PATCH] 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.
Rollout plan 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.
> Generated by Coder Agents on behalf of @DanielleMaywood. --- site/.knip.jsonc | 1 + site/.oxlintrc.jsonc | 14 ++++++++++++++ site/package.json | 1 + site/pnpm-lock.yaml | 16 ++++++++++++++++ site/pnpm-workspace.yaml | 7 +++++++ 5 files changed, 39 insertions(+) diff --git a/site/.knip.jsonc b/site/.knip.jsonc index 01862f11c1c..2b9ed680446 100644 --- a/site/.knip.jsonc +++ b/site/.knip.jsonc @@ -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" diff --git a/site/.oxlintrc.jsonc b/site/.oxlintrc.jsonc index b76c2f14fdd..160c1a45593 100644 --- a/site/.oxlintrc.jsonc +++ b/site/.oxlintrc.jsonc @@ -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", { diff --git a/site/package.json b/site/package.json index 9ebcb7798be..fe0948dcbf4 100644 --- a/site/package.json +++ b/site/package.json @@ -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", diff --git a/site/pnpm-lock.yaml b/site/pnpm-lock.yaml index cc8e4e36990..169701de2c6 100644 --- a/site/pnpm-lock.yaml +++ b/site/pnpm-lock.yaml @@ -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: {} diff --git a/site/pnpm-workspace.yaml b/site/pnpm-workspace.yaml index b04f29ed2e7..471730300a1 100644 --- a/site/pnpm-workspace.yaml +++ b/site/pnpm-workspace.yaml @@ -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