typescript-eslint "parserOptions.project ... TSConfig does not include"
Type-aware typescript-eslint rules need parserOptions.project (or projectService) so the parser can build a TypeScript program. Linting fails when a file is not included by any referenced tsconfig - config files, scripts, or test files often fall outside the app tsconfig.
What this error means
ESLint fails with Parsing error: ESLint was configured to run on <file> using parserOptions.project ... however that TSConfig does not include this file (or was not found by the project service). It is deterministic and names the excluded file.
/app/vite.config.ts
0:0 error Parsing error: ESLint was configured to run on
`/app/vite.config.ts` using `parserOptions.project`. However, that TSConfig
does not include this file.Common causes
File outside the linted tsconfig
A config/script/test file (e.g. vite.config.ts, *.config.ts) is linted with type-aware rules but is not in the include of the tsconfig given to parserOptions.project, so the parser has no program for it.
Wrong or missing project reference
parserOptions.project points at a tsconfig that does not cover the files being linted, or a monorepo package's files are linted against the root tsconfig.
How to fix it
Use projectService (modern typescript-eslint)
Let typescript-eslint manage the program so included/excluded files are handled automatically.
// eslint.config.js
export default [
{
languageOptions: {
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
},
},
]Or include the file / add a tsconfig that covers it
- Add the file to the
includeof the tsconfig referenced byparserOptions.project. - Or create a tsconfig (e.g.
tsconfig.node.json) covering config/script files and reference it. - Disable type-aware rules for files that genuinely should not be type-checked, via a flat-config override.
How to prevent it
- Prefer
projectService: trueover a fixedparserOptions.projectpath. - Ensure every linted file is covered by some tsconfig.
- Scope type-aware rules to source files; relax them for config/scripts.