ESLint "Parsing error: Cannot read file 'tsconfig.json'"
Type-aware ESLint (typescript-eslint) needs a tsconfig named by parserOptions.project. When that path does not resolve from where ESLint runs, the parser cannot read it and every file errors.
What this error means
ESLint fails on each file with Parsing error: Cannot read file '<tsconfig path>'. It is consistent and tied to the working directory or a wrong project path, common when CI runs ESLint from a different cwd than developers do.
/app/src/index.ts
0:0 error Parsing error: Cannot read file '/app/tsconfig.json'
# or with a glob:
Parsing error: Cannot read file '/app/packages/web/tsconfig.eslint.json'Common causes
parserOptions.project path is wrong
The project value is relative to tsconfigRootDir (or the config file). A wrong path, or running ESLint from a different cwd, makes the tsconfig unreadable.
tsconfig missing from the checkout
In a monorepo or partial checkout, the referenced tsconfig may not be present, so the parser cannot read it.
How to fix it
Anchor the project path with tsconfigRootDir
Set tsconfigRootDir so project resolves regardless of cwd.
// flat config (eslint.config.js)
languageOptions: {
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
}Ensure the tsconfig is present and correct
- Confirm the tsconfig path exists from the repo root in CI.
- Run ESLint from the repo root, matching the path in
project. - In monorepos, point
projectat each package's tsconfig or use a dedicatedtsconfig.eslint.json.
How to prevent it
- Set
tsconfigRootDirsoprojectis cwd-independent. - Run ESLint from a consistent directory in CI.
- Keep referenced tsconfigs in the checkout (not gitignored).