ESLint was configured to run using parserOptions.project, but the file is not in the TSConfig
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/component/TestComponent.cy.ts` using `parserOptions.project`Short answer
Type-aware linting needs every linted file to belong to a TypeScript project. The error means the file, often a Cypress spec or an eslint config, is not matched by any tsconfig listed in parserOptions. Add it to include, switch to projectService with allowDefaultProject, or lint it without type information.
Fix it fast
1Find out which cause you have
Open the tsconfig that parserOptions points to and compare its include and exclude lists with the path in the error message.
cat tsconfig.json2Match what you see, then jump to its fix
- 1
The file named in the error sits in a folder such as cypress, component or tests that tsconfig.json leaves out.The tsconfig include globs do not match the fileFix - 2
Adding the folder to tsconfig.json would change what gets built.The tsconfig used for the build must stay as it isFix - 3
The failing file is eslint.config.mjs, .eslintrc.cjs or a similar file in the project root.One or two config files are outside every projectFix - 4
The file is plain JavaScript, or a generated file.The file does not need type-aware rules at allFix
- 1
What does the error look like?
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/component/TestComponent.cy.ts` using `parserOptions.project`However, that TSConfig does not include this fileThe file must be included in at least one of the projects provided
Cause 1 of 4
The tsconfig include globs do not match the file
1Check
Open tsconfig.json and compare its include and exclude lists with the path in the error.
cat tsconfig.json2Fix
Add the folder to include. For .js, .cjs or .mjs files also turn on allowJs.
{
"include": ["src", "component", "cypress"]
}3Verify
Run ESLint on the file again.
npx eslint component/TestComponent.cy.tsConfirmed by typescript-eslint.io
Cause 2 of 4
The tsconfig used for the build must stay as it is
1Check
The build config should not list test or tool files, yet ESLint needs them in a project.
grep -n "project" eslint.config.* .eslintrc.*2Fix
Create a tsconfig.eslint.json that lists every file you lint, then point ESLint at it.
// tsconfig.eslint.json
{ "extends": "./tsconfig.json", "include": ["src", "component", "cypress", "*.config.*"] }
// eslint config
languageOptions: {
parserOptions: { project: "./tsconfig.eslint.json" },
},3Verify
Run ESLint on the failing file.
npx eslint component/TestComponent.cy.tsConfirmed by typescript-eslint.io
Cause 3 of 4
One or two config files are outside every project
1Check
Tool config files are usually not part of tsconfig.json. With projectService, the allowDefaultProject option lets a few of them run with default compiler options.
grep -n "projectService" eslint.config.*2Fix
Switch to the project service and list those files. Globs cannot contain **, and each match adds linting cost, so keep the list short.
parserOptions: {
projectService: {
allowDefaultProject: ["eslint.config.mjs"],
},
},3Verify
Run ESLint on the config file.
npx eslint eslint.config.mjsConfirmed by typescript-eslint.io
Cause 4 of 4
The file does not need type-aware rules at all
1Check
Type-checked rules only matter for files with types. JavaScript tool files can skip them.
grep -n "disableTypeChecked" eslint.config.*2Fix
Turn type-checked linting off for those files, or ignore them.
{
files: ['**/*.js'],
extends: [tseslint.configs.disableTypeChecked],
},3Verify
Run ESLint over the project.
npx eslint .Confirmed by typescript-eslint.io
How do I stop it coming back?
- Keep one tsconfig that covers every file ESLint lints, or a dedicated tsconfig.eslint.json.
- Set tsconfigRootDir so relative tsconfig paths do not depend on where you start ESLint.
- Update the parser package: newer versions print a clearer message for this error.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
Related fixes
Web apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fixWeb apps
Cypress refuses to start with 'Your configFile is invalid'
Your configFile threw an error from: /path/to/cypress.config.ts
Cypress could not load cypress.config.js or .ts, or found something wrong in it.
5 causes, each with a fixWeb apps
ESLint cannot decide which copy of the @typescript-eslint plugin to use
The message lists two file paths for the same plugin, each with the name of the config that loaded it
ESLint found the same plugin at two different file paths and will not pick one.
3 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
Upgrading to Next.js 16: middleware becomes proxy, and the other things that break
Missing Required default.js for Parallel Route
Next.js 16 renames middleware.ts to proxy.ts and its exported function to proxy.
6 causes, each with a fixWeb apps
TypeScript cannot resolve import './globals.css' in Next.js
ts(2882)
TypeScript now checks imports like import './globals.css' when noUncheckedSideEffectImports is on, and it finds no type for a CSS file.
2 causes, each with a fix