Skip to content
Latchkey

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.

eslint output
/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
// eslint.config.js
export default [
  {
    languageOptions: {
      parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
    },
  },
]

Or include the file / add a tsconfig that covers it

  1. Add the file to the include of the tsconfig referenced by parserOptions.project.
  2. Or create a tsconfig (e.g. tsconfig.node.json) covering config/script files and reference it.
  3. Disable type-aware rules for files that genuinely should not be type-checked, via a flat-config override.

How to prevent it

  • Prefer projectService: true over a fixed parserOptions.project path.
  • Ensure every linted file is covered by some tsconfig.
  • Scope type-aware rules to source files; relax them for config/scripts.

Frequently asked questions

What causes ""was not found by the project service""?
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.
How do I fix "was not found by the project service"?
Let typescript-eslint manage the program so included/excluded files are handled automatically.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card