fix(lint): native flat config for eslint-config-next 16, drop next lint - #85
Open
lacymorrow wants to merge 1 commit into
Open
lacymorrow wants to merge 1 commit into
lacymorrow wants to merge 1 commit into
Conversation
ESLint has not been runnable on main since the Next 16 bump:
- `next lint` was removed in Next 16, so `pnpm lint:eslint` fails immediately
- eslint-config-next 16 ships native flat configs, and FlatCompat cannot
convert them ("Converting circular structure to JSON")
Changes:
- eslint.config.mjs imports eslint-config-next/core-web-vitals and
eslint-config-next/typescript directly and uses typescript-eslint's
recommendedTypeChecked + stylisticTypeChecked (same presets as before)
- type-aware rules are disabled for files tsconfig.json excludes (scripts/,
tests/, src/workers/, (ai), (demo)/examples, *.config.ts), which previously
produced "parserOptions.project" parse errors
- lint:eslint / lint:fix:eslint now run `eslint .`
- typescript-eslint 8.70.0 added as a direct devDependency; @eslint/eslintrc
removed (no longer used)
`pnpm lint:eslint` now runs to completion: 75 errors, 124 warnings, all
pre-existing code findings (prefer-nullish-coalescing, no-unnecessary-type-
assertion, no-explicit-any, ...). Fixing those is separate work.
This is groundwork for ESLint 10, which is still blocked: eslint-config-next
depends on eslint-plugin-react 7.37.5, whose rules call context.getFilename(),
removed in ESLint 10 ("react/display-name: contextOrFilename.getFilename is not
a function"). No eslint-plugin-react release supports ESLint 10 yet.
Claude-Session: https://claude.ai/code/session_01KLWmWU1KLE2diUH14ryqv1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
One sentence
Makes ESLint runnable again after the Next 16 bump by importing eslint-config-next 16 flat configs directly and replacing the removed
next lintcommand; not a dependency bump, so left open for review.Why
Found while attempting the ESLint 10 major for LAC-3869. On
main,pnpm lint:eslintrunsnext lint, which Next 16 removed (https://github.com/vercel/next.js/blob/canary/docs/01-app/02-guides/upgrading/version-16.mdx). Runningeslintdirectly also crashes:eslint-config-next16 exports native flat-config arrays andFlatCompat.extends("next/core-web-vitals")fails withConverting circular structure to JSON.Changes
eslint.config.mjs: importseslint-config-next/core-web-vitalsandeslint-config-next/typescriptdirectly (the way the Next 16 docs show) and appliestypescript-eslintrecommendedTypeChecked+stylisticTypeChecked, the same presets FlatCompat used to pull in. Rule overrides and ignores are unchanged.tseslint.configs.disableTypeChecked) for the pathstsconfig.jsonexcludes (scripts/,tests/,src/workers/,(ai),(demo)/examples,*.config.ts,*.config.*.ts); those files produced"parserOptions.project" has been providedparse errors before.lint:eslint->eslint .,lint:fix:eslint->eslint . --fix.Result
pnpm lint:eslintnow completes: 75 errors and 124 warnings, all pre-existing code findings (24prefer-nullish-coalescing, 10no-unnecessary-type-assertion, 8no-explicit-any, 4require-await, 4no-require-imports, 2react/no-unescaped-entities, 2react/display-name, ...). Fixing them is separate work, sopnpm lintstill exits non-zero, but it now says why instead of crashing.ESLint 10 is still blocked
With this config and
eslint@10.10.0, linting any component crashes inreact/display-name:contextOrFilename.getFilename is not a function.eslint-config-next@16.3.5depends oneslint-plugin-react@^7.37.0; 7.37.5 (April 2025) is the latest release and still usescontext.getFilename(), which ESLint 10 removed. Its peer range iseslint ^3 ... ^9.7;eslint-plugin-importandeslint-plugin-jsx-a11yalso cap at^9. Untileslint-plugin-reactships ESLint 10 support andeslint-config-nextpicks it up, ESLint 10 cannot be adopted here. Source: https://github.com/eslint/eslint/blob/main/docs/src/use/migrate-to-10.0.0.mdVerification
pnpm typecheckcleanpnpm test: 4 files, 16 tests greenpnpm exec vitest run --config vitest.config.node.ts: 3 files, 21 tests greenpnpm buildpassesnext startsmoke:/200,/changelog200,/changelog/nope-xyz404,/faq200,/nope-404404Installed with
--ignore-scripts(isolated-vm postinstall fails under Node 26 locally; matches how Vercel builds).https://claude.ai/code/session_01KLWmWU1KLE2diUH14ryqv1