ESLint v9 migration. Next build folder included.
Answered
Korat posted this in #help-forum
KoratOP
Hi everyone. I'm trying to migrate eslint of my nextjs boilerplate (https://github.com/OreQr/next-clean-boilerplate) to v9.
Everything seems working but it starts including .js files from .next build folder, even when I manually ignore it with config.
Error on every .js file in .next folder:
Everything seems working but it starts including .js files from .next build folder, even when I manually ignore it with config.
Error on every .js file in .next folder:
.next/static/development/_buildManifest.js
Error: Parsing error: ESLint was configured to run on `<tsconfigRootDir>/.next\static\development\_buildManifest.js` using `parserOption
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-of-those-tsconfigs-include-this-fileAnswered by Korat
Fixed my eslint looks like that https://github.com/OreQr/next-clean-boilerplate/blob/main/eslint.config.mjs
6 Replies
KoratOP
eslint
tsconfig
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.mjs",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}KoratOP
KoratOP
It starts working when I added
{ ignores: [".next"] } on top of eslint config. But before I doesn't need to do that. I'm missing something?KoratOP
Now I checked and it doesn't lint .ts .tsx files
KoratOP
Fixed my eslint looks like that https://github.com/OreQr/next-clean-boilerplate/blob/main/eslint.config.mjs
Answer