Skip to content

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. #5765

Closed
@jez9999

Description

@jez9999

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Issue Description

I recently added a couple of ESLint rules that required me to add this to my .eslintrc.cjs config:

	"parserOptions": {
		"ecmaVersion": "latest",
		"project": "./tsconfig.json",
		"parser": "@typescript-eslint/parser"
	},

This is causing the following error in VS Code in some of my TS and JS files:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src\router.js.
The file must be included in at least one of the projects provided.

The weird thing is I will get this error in a TS file in a dir, but not in another TS file in the same dir. If I rename the file with the error (something like file.ts -> file2.ts), the error will disappear, and it appears when I rename it back, so I assume it's some weird caching issue.

In my example repo, I'm getting the error for src/router.js but not for src/main.js.

Reproduction Repository Link

https://gitlab.com/jez9999/eslint-bug

Repro Steps

  1. clone the repo
  2. npm install
  3. npm run lint

Versions

package version
TypeScript 4.8.4
ESLint 8.23.1
node 16.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexternalThis issue is with another package, not typescript-eslint itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions