Skip to content

Newly created Vue SFC File: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser #1303

Closed
@eyedean

Description

@eyedean

What code were you trying to parse?
I run into the infamous error of not finding the parser (similar to #1159 and #883) for new Vue files I create in my project. NOTE: a restart of VS and my live compiler eliminates the problem until the next time I create a new .vue file.

I am using Quasar, and vue-class-component for my SFC Vue files.

Error details:

 error  in ./src/components/signup/CLSignupStepperHeader.vue

Module Error (from ./node_modules/eslint-loader/index.js):

/Users/eyedean/dev/xxxxx/src/components/signup/CLSignupStepperHeader.vue
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/components/signup/CLSignupStepperHeader.vue.
The file must be included in at least one of the projects provided

✖ 1 problem (1 error, 0 warnings)


 @ ./node_modules/ts-loader??ref--10-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/signup/CLSignupStepVitals.vue?vue&type=script&lang=ts& 10:0-81 143:12-33

Per the request at #1159 (comment) I am creating this new ticket.

What did you expect to happen?
The new Vue file should be picked up normally. Again, a restart of live tsc and VS code fixes it, but it kinda takes 1 minute for my project.

What actually happened?
It used to work flawlessly until I upgraded typescript-eslint, after a few months, recently. Looking at e3f3448 which was the fix for a similar problem, the symptom I am seeing is very related to parsedFilesSeen not picking up the newly created file .vue on-the-fly.

Additional Notes
Per https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser for parsing Vue files, I have the following in my .eslintrc:

	parser: "vue-eslint-parser",
	
	// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
	// See https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser
	// `parser: "vue-eslint-parser"` is already included with any "plugin:vue/**" config and should be omitted
	parserOptions: {
		project: "./tsconfig.eslint.json",
		parser: "@typescript-eslint/parser",
		sourceType: "module",
		extraFileExtensions: [".vue"]
	},

And then it is in my tsconfig.eslint.json that I am mentioning all the Vue files should be picked:

{
	"extends": "./tsconfig.json",
	"include": [
	  "**/*.ts",
	  "**/*.js",
	  "**/*.vue",
	  "**/*.json",
	],
	"compilerOptions": {
	  "allowJs": true,
	  "checkJs": true
	}
}

Versions

package version
@typescript-eslint/parser 2.10.0 (was the same on 2.8.0)
TypeScript 3.3.3
ESLint 5.16.0 (It's on purpose to be on 5, rather than 6)
node 12.3.1
npm 6.13.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreetriageWaiting for team members to take a look

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions