next lint fails when using ESLint v8 flat config #75298
Labels
linear: next
Confirmed issue that is tracked by the Next.js team.
Linting
Related to `next lint` or ESLint with Next.js.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/xenodochial-voice-lfgj88?workspaceId=ws_XCEs1GT1FEw6tFStZG4Cnd
To Reproduce
Current vs. Expected behavior
Current behavior
next lint
does not work with an ESLint flat config (e.g.,eslint.config.js
) oneslint@^8.21.0
.It does work successfully with
eslint@^9
.Expected behavior
It is expected that
next lint
runs successfully with a valid ESLint flat config oneslint@^8
andeslint@^9
.ESLint introduced the flat config in v8.21.0 and it is the default format in v9.x.
Although ESLint v8.x has reached end-of-life, some widely used shared configs have not yet migrated to v9.x (e.g., eslint-config-airbnb). Flat config compatibility with
next lint
and ESLint v8.x allows codebases tied to ESLint v8.x to avoid or move away from the deprecated eslintrc format.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Available memory (MB): 4242 Available CPU cores: 2 Binaries: Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 15.2.0-canary.25 // Latest available version is detected (15.2.0-canary.25). eslint: 8.57.1 eslint-config-next: 15.1.6 react: 19.0.0 react-dom: 19.0.0 typescript: 5.3.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Linting
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
I believe the culprit is the following ESLint v9.x version check:
https://github.com/vercel/next.js/blob/v15.2.0-canary.25/packages/next/src/lib/eslint/runLintCheck.ts#L178-L193
Patching it to support ESLint versions greater than v8.21.0 worked in my case:
The text was updated successfully, but these errors were encountered: