Link to the code that reproduces this issue
https://github.com/leetdavid/nextjstest
To Reproduce
- Run
pnpm create next-app with ESLint Enabled
- Rename
.eslintrc.json to eslint.config.js
- Run
pnpm lint and it will create yet another .eslintrc.json after prompting.
Current vs. Expected behavior
I expect next lint to recognize the eslint.config.js file, but it does not.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024
Available memory (MB): 31658
Available CPU cores: 32
Binaries:
Node: 21.7.1
npm: 10.5.0
Yarn: N/A
pnpm: 8.15.6
Relevant Packages:
next: 14.2.1 // Latest available version is detected (14.2.1).
eslint-config-next: 14.2.1
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
ESLint (eslint-config-next)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I renamed the .eslintrc.json file to eslint.config.js and the above happens.
I am using turborepo.
Renaming my eslint file to .eslintrc.json file results in another error:
pnpm lint
╰─ pnpm lint
> @monorepo-name/[email protected] lint /<repo path>/apps/web
> next lint
Cannot read config file: /<repo path>/tools/eslint-config/base.js
Error: Unexpected token 'export'
Referenced from: /<repo path>/apps/web/.eslintrc.json
apps/web/.eslintrc.json (my next.js project path's .eslintrc.json, after renaming from eslint.config.js)
{
"root": true,
"extends": [
"@monorepo-name/eslint-config/base",
"@monorepo-name/eslint-config/nextjs",
"@monorepo-name/eslint-config/react"
]
}
tools/eslint-config/base.js
/** @type {import("eslint").Linter.Config} */
const config = {
extends: [
"turbo",
"prettier",
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
],
...
}
export default config;
tools/eslint-config/nextjs.js
/** @type {import('eslint').Linter.Config} */
const config = {
extends: ["plugin:@next/next/core-web-vitals"],
rules: {
"@next/next/no-html-link-for-pages": "off",
},
};
export default config;
NEXT-3316
Link to the code that reproduces this issue
https://github.com/leetdavid/nextjstest
To Reproduce
pnpm create next-appwith ESLint Enabled.eslintrc.jsontoeslint.config.jspnpm lintand it will create yet another.eslintrc.jsonafter prompting.Current vs. Expected behavior
I expect
next lintto recognize theeslint.config.jsfile, but it does not.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024 Available memory (MB): 31658 Available CPU cores: 32 Binaries: Node: 21.7.1 npm: 10.5.0 Yarn: N/A pnpm: 8.15.6 Relevant Packages: next: 14.2.1 // Latest available version is detected (14.2.1). eslint-config-next: 14.2.1 react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/AWhich area(s) are affected? (Select all that apply)
ESLint (eslint-config-next)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I renamed the
.eslintrc.jsonfile toeslint.config.jsand the above happens.I am using turborepo.
Renaming my eslint file to
.eslintrc.jsonfile results in another error:pnpm lintapps/web/.eslintrc.json(my next.js project path's .eslintrc.json, after renaming fromeslint.config.js)tools/eslint-config/base.jstools/eslint-config/nextjs.jsNEXT-3316