Skip to content

Replace eslint-plugin-react with @eslint-react for ESLint 10 - #44

Merged
owjs3901 merged 1 commit into
mainfrom
remove-eslint-plugin-react
Aug 21, 2026
Merged

Replace eslint-plugin-react with @eslint-react for ESLint 10#44
owjs3901 merged 1 commit into
mainfrom
remove-eslint-plugin-react

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Why

eslint-plugin-react@7.37.5 (its latest release) does not support ESLint 10 — the version we already require (eslint: ">=10.7").

eslint-plugin-react@7.37.5 peerDependencies.eslint
  = "^3 || ^4 || ^5 || ^6 || ^7 || ^8.0.0-0 || ^9.7.0"

ESLint 10 is deliberately excluded, and the maintainer confirms this is intentional (jsx-eslint/eslint-plugin-react#4018). Consumers currently hit hard crashes:

  • TypeError: Error while loading rule 'react/display-name': contextOrFilename.getFilename is not a function
    lib/util/version.js calls context.getFilename(), removed in ESLint 10. Only reachable when settings.react.version === 'detect', which this config sets.
  • TypeError: sourceCode.isSpaceBetweenTokens is not a function in react/jsx-tag-spacing
    — ESLint 10 renamed SourceCode#isSpaceBetweenTokens to isSpaceBetween.

Pinning settings.react.version only clears the first one, so the config cannot be salvaged through options. The upstream fix (jsx-eslint/eslint-plugin-react#4022) is still unmerged with no prerelease on npm, so this replaces the plugin instead of waiting.

What changed

Role Before After
React correctness rules eslint-plugin-react flat.recommended @eslint-react/eslint-plugin recommended-typescript
JSX formatting react/jsx-curly-brace-presence, react/jsx-tag-spacing @stylistic/eslint-plugin (same rules, same options)
JSX prop sorting react/jsx-sort-props eslint-plugin-perfectionist sort-jsx-props

All three replacements declare ESLint 10 support (@stylistic peer is ^9.0.0 || ^10.0.0, the other two are unconstrained).

Rules dropped as obsolete for React 19 + TypeScript, with no equivalent needed:

  • react/react-in-jsx-scope, react/jsx-uses-react — automatic JSX runtime
  • react/prop-types, react/sort-default-props — TypeScript / defaultProps removal
  • react/jsx-no-undeftsc and core no-undef cover it

reservedFirst: true is preserved through a perfectionist reserved custom group matching ^(key|ref)$.

Oxlint plugin

src/oxlint.ts wrapped three eslint-plugin-react rules that oxlint has no native equivalent for. prop-types was always forced off by devupRuleOverrides and sort-default-props is obsolete, so only prop sorting remains — now sourced from perfectionist:

  • devup/react/prop-types — removed (was always off)
  • devup/react/sort-default-props — removed (obsolete)
  • devup/react/jsx-sort-propsdevup/perfectionist/sort-jsx-props

The react/* entries under rules: in src/oxlint-config.ts are oxlint's built-in react plugin and are untouched.

Dependencies

Ran bunx @dependency-check-updates/cli -d -u --rm. typescript was bumped to ^7.0 by the tool and reverted to ^6.0, because typescript-eslint throws on TS 7 (peer: >=4.8.4 <6.1.0, and it targets TS >= 7.1 per typescript-eslint#10940).

Also picked up: simple-import-sort 13 → 14, oxlint 1.73 → 1.79, typescript-eslint 8.64 → 8.67, actions/setup-node v6 → v7.

eslint-plugin-react is now absent from package.json, bun.lock, and every source file — bun why eslint-plugin-react reports it is not in the lockfile.

Breaking change note

Marked Minor in the changepack, but consumers who override any react/* rule will need to update: with the react plugin no longer registered, ESLint 10 fails config resolution with Could not find plugin react. Rule id mapping is in the changepack note.

Verification

  • bun test — 83 pass, 100% line and function coverage maintained
  • bun run lint (oxlint) — exit 0
  • bun run build (tsc + 4 bundles) — exit 0
  • oxlint JS-plugin path exercised against a real JSX fixture:
    devup(perfectionist/sort-jsx-props): Expected "ref" (reserved) to come before "aria-label" (unknown).
    
  • Integration-tested against devup-ui via bun link: with this branch its eslint run goes from a hard crash to exit 0 (0 errors, 20 advisory @eslint-react warnings), after deleting the local workaround that stripped eslint-plugin-react out of configs.recommended.

@owjs3901
owjs3901 merged commit 5ce9b34 into main Aug 21, 2026
1 check passed
@owjs3901
owjs3901 deleted the remove-eslint-plugin-react branch August 21, 2026 12:37
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.

1 participant