P粉2367436892023-09-03 13:09:12
据我所知,您有两个选择:
将解析器:“vue-eslint-parser”
更改为@typescript-eslint/parser
为 .ts 文件添加覆盖,并将解析器设置为 @typescript-eslint/parser
P粉0388567252023-09-03 00:38:58
我想我太累了或者太老了,无论如何,问题在于同一个 lint 文件中有两个 parserOptions
部分。这是最终的工作版本:
module.exports = { root: true, env: { browser: true, es2021: true, }, extends: [ "eslint:recommended", "plugin:vue/vue3-essential", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", "prettier", ], parser: "vue-eslint-parser", parserOptions: { parser: "@typescript-eslint/parser", project: ["./tsconfig.json"], ecmaVersion: "latest", sourceType: "module", extraFileExtensions: [".vue"], }, // parserOptions: { // ecmaVersion: "latest", // sourceType: "module", // }, plugins: ["vue", "@typescript-eslint"], };