Skip to content

Drop eslint-plugin-react - #2466

Merged
spaceninja merged 1 commit into
mainfrom
drop-eslint-plugin-react
Aug 31, 2026
Merged

Drop eslint-plugin-react#2466
spaceninja merged 1 commit into
mainfrom
drop-eslint-plugin-react

Conversation

@spaceninja

Copy link
Copy Markdown
Member

Overview

eslint-plugin-react@7.37.5 supports ESLint ^9.7 at most, and that is the latest release — the next tag is still 7.8.0-rc.0. It is the one thing keeping this repo on ESLint 9, and therefore off @cloudfour/eslint-config v26, whose peer range is ^10.6.0. #2458 currently cannot even get through npm ci because of it.

We used the plugin for exactly one rule. react/jsx-uses-vars marks JSX-referenced identifiers as used, which our .mdx docs pages rely on — they import Storybook's doc components and their own stories module, then reference them only inside JSX. no-unused-vars does not count a JSX reference as a use, so without that rule it reports every one of those imports. I measured it by removing the plugin and running the linter: 171 errors across 83 files.

Turning no-unused-vars off for .mdx files covers the same ground without the dependency. The trade-off is that a genuinely unused import in an .mdx file stops being reported — these are documentation pages, so that seems a cheap price for unblocking a major upgrade. eslint-plugin-react-x was considered as a replacement and rejected: at 5.18.6 it has no jsx-uses-vars equivalent, so it isn't a drop-in.

This does not upgrade ESLint itself. It only removes the blocker, so #2458 can proceed once #2465 (TypeScript 6) lands too.

Screenshots

Testing

  • Run npm ci followed by npm run preprocess, then npm run lint:check — it should pass with no errors
  • Open any component's docs page source, e.g. src/components/alert/alert.mdx, and confirm the Canvas/Meta imports at the top are not reported as unused
  • Add a genuinely unused import to a .ts or .js file and confirm npm run lint:check still catches it there — the change should only affect .mdx
  • Run npm run type and npm run build, both of which should succeed
  • Run npm start and click through a few component docs pages in Storybook — the Canvas, Controls and Meta blocks should all render as before

Note on npm test: 5 of the 12 test files fail locally for me, all browser tests erroring with "Failed to fetch dynamically imported module". They fail identically on unmodified main, so they are unrelated to this change — worth confirming they behave the same in CI.


Closes #2464
Unblocks #2458

`eslint-plugin-react@7.37.5` declares support for ESLint `^9.7` at most,
and 7.37.5 is the latest release -- the `next` tag is still `7.8.0-rc.0`.
That makes it the one thing preventing this repo from moving to ESLint
10, and with it `@cloudfour/eslint-config` v26, whose peer range is
`^10.6.0`. See #2458, which cannot even `npm ci` today.

We used the plugin for exactly one rule. `react/jsx-uses-vars` marks
JSX-referenced identifiers as used, which our .mdx docs pages need:

    import { Canvas, Meta } from '@storybook/addon-docs/blocks';
    import * as AlertStories from './alert.stories.js';

    <Meta of={AlertStories} />

`no-unused-vars` does not count a JSX reference as a use, so without that
rule it reports every one of those imports -- 171 errors across 83 files,
measured by removing the plugin and running the linter.

Turning `no-unused-vars` off for .mdx files covers the same ground
without the dependency. The trade-off is that a genuinely unused import
in an .mdx file stops being reported; these are documentation pages, so
that seems a cheap price for unblocking the upgrade.

`eslint-plugin-react-x` was considered as a replacement and rejected: at
5.18.6 it has no `jsx-uses-vars` equivalent, so it is not a drop-in.

Closes #2464
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3e5b483

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploy Preview for cloudfour-patterns ready!

Name Link
🔨 Latest commit 3e5b483
🔍 Latest deploy log https://app.netlify.com/projects/cloudfour-patterns/deploys/6a960be95aa884000821f7c2
😎 Deploy Preview https://deploy-preview-2466--cloudfour-patterns.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@spaceninja
spaceninja merged commit cc2e0dd into main Aug 31, 2026
8 checks passed
@spaceninja
spaceninja deleted the drop-eslint-plugin-react branch August 31, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop eslint-plugin-react so we can upgrade to ESLint 10

1 participant