parserOptions.project has been set for @typescript-eslint/parse
Author:zhoulujun Date:
最近需要接入公司的eslint标准,eslint-config-tencent、@blueking/eslint-config-bk,但是发现:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does,打开intelliJ 或者webstorm,
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.
百思不得骑姐呀!
百度谷歌搜了一下,答案众多
比如:
有两个相同的文件,在一个目录下,ts 解析会问题
有比如:
ES6 import等报错:配置 "parser": "babel-eslint"
https://www.csdn.net/tags/Ntzacg5sNDU2MTQtYmxvZwO0O0OO0O0O.html
其实,大多无用
解决Parsing error: "parserOptions.project" ……办法
第一,配置:tsconfig.json
exclude .eslintrc.js
{ "exclude": [ "node_modules", "plugins", "env.js", "babel.config.js", "bk.config.js", ".eslintrc.js", "webpack.config.js", "src/components/vue-grid-layout", "src/components/monaco", "src/utils/login.js", "test", ] }
这样还是不能彻底解决问题
第二,核对eslint版本依赖
查看 [email protected] 的package.json,发现其中的eslint 版本为:
eslint": "^7.28.0 || ^8.0.0
只有安装 "eslint": "~8.13.0",才可以,安装最新版本的 "eslint": "~8.14.0”,就会出现:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
转载本站文章《parserOptions.project has been set for @typescript-eslint/parse》,
请注明出处:https://www.zhoulujun.cn/html/Operation/codeGuide/8802.html