什么意思是“解析错误:"parserOptions.project"已为@ typescript-eslint/parser设置." IntelliJ IDEs系列中出现错误? [英] What means 'Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.' error in IntelliJ IDEs family?
本文介绍了什么意思是“解析错误:"parserOptions.project"已为@ typescript-eslint/parser设置." IntelliJ IDEs系列中出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我打开.vue
文件时,IntelliJ IDEA中出现以下错误:
When I open .vue
file, below error appears in my IntelliJ IDEA:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: XX\XX\CurrentFile.vue.
The file must be included in at least one of the projects provided.
如果您能教我解决方案,我当然会很高兴,但首先我知道它的意思,为什么会出现.
Of course I will be glad if you teach me the solution, but first what I know what it means and WHY it appears.
我怀疑这是某种错误或错误消息.实验上知道什么:
I suspect that it is a some kind of bug, or inaccurate error message. Experimentally known what:
- 有时会出现-否.
- 它总是在更新时出现.
- 如果要从控制台运行某些
.vue
文件的eslint
,则eslint将正确完成执行.因此,似乎这不是随便的臭虫.
- Sometimes it appears, sometimes - no.
- It always appears when update eslint.
- If to run
eslint
from console for some.vue
file, eslint will finish the execution correctly. So seems like it is no eslint bug.
我的Eslint配置(YAML):
My Eslint config (YAML):
parser: vue-eslint-parser
parserOptions:
parser: "@typescript-eslint/parser"
sourceType: module
project: tsconfig.json
tsconfigRootDir: ./
extraFileExtensions: [ ".vue" ]
env:
es6: true
browser: true
node: true
plugins:
- "@typescript-eslint"
- vue
rules:
// ...
TypeScript设置:
TypeScript settings:
{
"compilerOptions": {
"target": "ES2017",
"module": "CommonJS",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"strict": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"importsNotUsedAsValues": "preserve", // Limitation of the transpileOnly mode from ts-loader for .vue files.
"baseUrl": "./",
"paths": {
// ...
}
}
}
推荐答案
您需要将文件添加到tsconfig中的include
数组中:
You need to add your files to the include
array in your tsconfig:
"include": [
"path/to/src/**/*"
]
来源: Github 和StackOverflow
这篇关于什么意思是“解析错误:"parserOptions.project"已为@ typescript-eslint/parser设置." IntelliJ IDEs系列中出现错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文