You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run linting using Next.js and observe that it fails to run, indicating there are invalid ESLint config options
$ pnpm exec next lint
Invalid Options:
- Unknown options: useEslintrc, extensions, resolvePluginsRelativeTo, rulePaths, ignorePath, reportUnusedDisableDirectives
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.
- 'ignorePath' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
- 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.
Run linting using ESLint that it runs successfully
$ pnpm exec eslint .
Current vs. Expected behavior
Current behavior
next lint does not work with an ESLint flat config (e.g., eslint.config.js) on eslint@^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 on eslint@^8 and eslint@^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:
Patching it to support ESLint versions greater than v8.21.0 worked in my case:
- if (_semver.default.gte(eslintVersion, '9.0.0') && useFlatConfig) {+ if (_semver.default.gte(eslintVersion, '8.21.0') && useFlatConfig) {
for (const option of [
'useEslintrc',
'extensions',
The text was updated successfully, but these errors were encountered:
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: