Unblock ESLint 10 via patch-package + peer overrides#60
Merged
Conversation
Both eslint-plugin-react (#3977) and eslint-plugin-jsx-a11y (#1075) cap their peer at eslint ^9 and have open-but-not-yet-merged ESLint 10 support PRs upstream. Two lightweight pieces of infra carry us across: - `package.json > overrides` widens the eslint peer for both plugins to ^10 so npm doesn't reject the install. Neither plugin actually needs to be re-published for the override to bite — the running copies are loaded the same way. - `patches/eslint-plugin-react+7.37.5.patch` (applied via the new patch-package postinstall) fixes the single line that crashes the plugin on ESLint 10: `contextOrFilename.getFilename()` in `lib/util/version.js`. The patch adds the `.filename` fallback path that ESLint 8.40+ has supported and that v10 made the only choice. jsx-a11y needs no code patch — confirmed by grepping its lib/ for every removed-in-v10 context method. eslint and @eslint/js are bumped to ^10. All four CI gates green from a clean install (postinstall fires the patch before lint/test/build run). CLAUDE.md now documents the patch + override mechanism and the exit criterion: drop both the moment upstreams publish fixed releases, then bump past the broken versions. A version bump on eslint-plugin-react past 7.37.5 will fail patch-package and fail `npm ci` loudly — a forced re-evaluation rather than silent drift.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #59. That PR documented ESLint 10 as blocked on upstreams;
this one ships the unblock as a local patch instead of waiting.
What this PR does
eslintand@eslint/jsto^10.patch-packageas a devDep + apostinstallscript.patches/eslint-plugin-react+7.37.5.patch— a6-line diff against
lib/util/version.jsthat adds a.filenamefallback for
context.getFilename()(the API ESLint 10 removed).npm overrideswidening theeslintpeer for botheslint-plugin-reactandeslint-plugin-jsx-a11yto^10, so npmdoesn't reject the install.
eslint-plugin-jsx-a11yneeds no code patch — confirmed by greppingits
lib/for every context method ESLint 10 removed(
getFilename/getSourceCode/getScope/getAncestors/markVariableAsUsed). The override on its peer range is enough.eslint-plugin-react-hooks@7.1.1already declareseslint ^10support — no help needed.
Why a patch and not just an override
I tried override-only first; the plugin's
version.jsblows up atruntime the moment ESLint 10 hands it a
contextwithoutgetFilename:The fix is what upstream PR
#3979
will eventually land — but that PR is itself blocked on
eslint-plugin-import#3230,
so "wait for upstream" is open-ended. The local diff is small,
documented, and self-removing: if the plugin is bumped past 7.37.5,
patch-packagewill fail loudly duringnpm ciand force are-evaluation rather than silently drift.
Gates
All four CI gates green from a fresh
npm ci(postinstall fires thepatch before any of them run):
cd backend && ruff check .— cleancd backend && pytest tests/ -q— 557 passedcd frontend && npm run lint— 0 warnings (strict)cd frontend && npm run test:ci— 91 passedcd frontend && npm run build— cleanExit criterion
Drop the patch + both overrides +
patch-packageitself oncejsx-eslint/eslint-plugin-react#3977
and
jsx-eslint/eslint-plugin-jsx-a11y#1075
ship, then bump both plugins past the patched version. CLAUDE.md
documents this so a future bump doesn't accidentally leave the patch
mechanism in place after it's no longer needed.
Generated by Claude Code