fix(next-codemod): only bump eslint when it does not satisfy the eslint-config-next peer range - #98593
Open
devtechedge wants to merge 1 commit into
Open
fix(next-codemod): only bump eslint when it does not satisfy the eslint-config-next peer range#98593devtechedge wants to merge 1 commit into
devtechedge wants to merge 1 commit into
Conversation
…nt-config-next peer range The upgrade tool resolved the newest eslint release matching the eslint-config-next peer range and pinned it, even when the project's existing specifier already satisfied that range. Projects using plugins that do not support the newest eslint major yet failed npm install before any transformation ran. Leave the specifier untouched when it satisfies the peer range. When a bump is required, pin the highest release of the lowest major satisfying the range instead of the newest eslint release. Fixes vercel#98417
devtechedge
added a commit
to devtechedge/oss-contributions
that referenced
this pull request
Sep 11, 2026
devtechedge
added a commit
to devtechedge/oss-contributions
that referenced
this pull request
Sep 12, 2026
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.
What?
@next/codemod upgradeno longer rewrites the project'seslintspecifierwhen it already satisfies the
eslint-config-nextpeer range. A project oneslint@^9stays on^9instead of being pinned to the newest ESLint 10release.
When a bump is still required (for example
eslint@^8against a>=9peer),the tool pins the highest release of the lowest major satisfying the peer
range, so projects land on the closest satisfying major instead of the newest
eslint release.
Fixes #98417
Why?
eslint-config-next@16declareseslint: ">=9.0.0". The upgrade tool calledloadHighestNPMVersionMatching("eslint@>=9")and wrote the result as an exactpin, so a project on
^9got forced onto the newest ESLint 10 release. Withplugins that do not support ESLint 10 yet (e.g.
eslint-plugin-import), thepost-upgrade
npm installfailed before any transformation ran, per thelinked issue's repro.
How did you fix it?
resolveEslintUpgradeTargetinbin/shared.ts. It returnsnull (leave the specifier untouched) when the installed specifier satisfies
the peer range - including specifiers entirely above the peer minimum, so
nothing gets downgraded - or when it cannot be interpreted as a semver range
(
latest, workspace/npm aliases). Otherwise it resolves the highest releaseof the lowest major satisfying the peer range through the injected resolver.
bin/upgrade.tsuses the helper for the eslint alignment step. Behavior forprojects below the peer range is unchanged except that the target is the
lowest satisfying major rather than the newest release.
bin/__tests__/eslint-upgrade-target.test.ts.How to test?
pnpm test packages/next-codemod/bin/__tests__/eslint-upgrade-target.test.tsnpx @next/codemod@canary upgrade lateston a
create-next-app@15.5.0project witheslint@^9+eslint-plugin-import. The manifest keeps"eslint": "^9"and the installsucceeds.