codemod: bump eslint alongside eslint-config-next (#95314)
## Why Today, running \`npx @next/codemod upgrade canary\` against any default-CNA-15 project fails at \`npm install\` with an \`ERESOLVE\` peer-dep error: \`\`\` Found: eslint@8.57.1 Could not resolve dependency: peer eslint@">=9.0.0" from eslint-config-next@16.3.0-canary.71 \`\`\` The codemod bumps \`eslint-config-next\` (Next 15 -> Next 16) but leaves \`eslint@^8\` alone, so npm can't reconcile peers and the install dies before any jscodeshift transforms can run. Caught while testing vercel/next.js#95312 against \`cna-15.0.0-app\`. ## What Adds \`eslint\` to the \`versionMapping\` in \`upgrade.ts\` when the project has \`eslint\` installed. The new version is picked by reading \`eslint-config-next@<target>\`'s \`peerDependencies.eslint\` range and resolving the highest matching published version (same pattern \`@types/react\` already uses). If anything goes wrong fetching the peer range (network blip, missing peer entry), the bump is skipped and a verbose-only warning is printed — the user just hits whatever they would have hit without this change. ## How \`pnpm --filter @next/codemod build\` clean. To test locally: downgrade a Next 16 project to Next 15 + eslint 8 + react 18, then run \`node packages/next-codemod/bin/next-codemod.js upgrade canary --yes\` and confirm the install succeeds. <!-- NEXT_JS_LLM_PR -->
Showing
Please
register
or
sign in
to comment