question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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"
	},

My .tsconfig.json looks like:

{
	"extends": "@vue/tsconfig/tsconfig.web.json",
	"include": [
		"env.d.ts",
		"src/**/*",
		"src/**/*.vue"
	],
	"exclude": [
		"src/**/__tests__/*"
	],
	"compilerOptions": {
		"allowJs": true,
		"outDir": "dist",
		"noImplicitAny": true,
		"jsx": "preserve",
		"composite": true,
		"baseUrl": ".",
		"paths": {
			"@/*": [
				"./src/*"
			]
		}
	},
	"references": [
		{
			"path": "./tsconfig.config.json"
		},
		{
			"path": "./tsconfig.app.json"
		},
		{
			"path": "./tsconfig.vitest.json"
		}
	]
}

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\lib\game\libHex.ts. The file must be included in at least one of the projects provided.eslint

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. How can I fix it?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

"parserOptions.project" has been set for @typescript-eslint ...
Parsing error : "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: /Users/Dan/site ...
Read more >
"parserOptions.project" has been set for @typescript-eslint ...
I have tried to change the include config as following, the error still be there. // 1. Error about js file { ...,...
Read more >
"parserOptions.project" has been set for @typescript-eslint ...
The error 'Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser' occurs when we try to lint files that aren't included in our ...
Read more >
How to fix VSC ESLint error "The file must be included in at ...
Parsing error : "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js ...
Read more >
IDE displays ESLint error "'parserOptions.project' has been set ...
IDE displays ESLint error "'parserOptions.project' has been set for '@typescript-eslint/parser'" in ".vue" files, but CLI works properly. image.png
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found