Skip to content

Unblock ESLint 10 via patch-package + peer overrides#60

Merged
it-rec merged 1 commit into
mainfrom
claude/eslint-10-patches
May 18, 2026
Merged

Unblock ESLint 10 via patch-package + peer overrides#60
it-rec merged 1 commit into
mainfrom
claude/eslint-10-patches

Conversation

@it-rec
Copy link
Copy Markdown
Owner

@it-rec it-rec commented May 18, 2026

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

  • Bumps eslint and @eslint/js to ^10.
  • Adds patch-package as a devDep + a postinstall script.
  • Vendors one patch: patches/eslint-plugin-react+7.37.5.patch — a
    6-line diff against lib/util/version.js that adds a .filename
    fallback for context.getFilename() (the API ESLint 10 removed).
  • Adds npm overrides widening the eslint peer for both
    eslint-plugin-react and eslint-plugin-jsx-a11y to ^10, so npm
    doesn't reject the install.

eslint-plugin-jsx-a11y needs no code patch — confirmed by grepping
its 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.1 already declares eslint ^10
support — no help needed.

Why a patch and not just an override

I tried override-only first; the plugin's version.js blows up at
runtime the moment ESLint 10 hands it a context without
getFilename:

TypeError: contextOrFilename.getFilename is not a function
  at resolveBasedir (.../eslint-plugin-react/lib/util/version.js:31)

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-package will fail loudly during npm ci and force a
re-evaluation rather than silently drift.

Gates

All four CI gates green from a fresh npm ci (postinstall fires the
patch before any of them run):

  • cd backend && ruff check . — clean
  • cd backend && pytest tests/ -q — 557 passed
  • cd frontend && npm run lint — 0 warnings (strict)
  • cd frontend && npm run test:ci — 91 passed
  • cd frontend && npm run build — clean

Exit criterion

Drop the patch + both overrides + patch-package itself once
jsx-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

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.
@it-rec it-rec merged commit 7f88873 into main May 18, 2026
5 checks passed
@it-rec it-rec deleted the claude/eslint-10-patches branch May 18, 2026 07:18
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.

2 participants