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