eslint? vue? ?? ?????? ? *.ts ??? javascript? ?????.
P粉739706089
2023-09-02 19:59:50
<p>typescript? vue? ???? ? ????? ???? ????. typescript-eslint ? eslint-plugin-vue? ?? ??? ?? ? ?? eslint ??? ??????. </p>
<pre class="brush:php;toolbar:false;">module.exports = {
??: ??,
??: {
????: ??,
es2021: ??,
},
??: [
"eslint:??",
"????:vue/vue3-essential",
"plugin:@typescript-eslint/recommended",
"????:@typescript-eslint/recommended-requiring-type-checking",
"? ???",
],
??: "vue-eslint-parser",
????: {
??: "@typescript-eslint/parser",
????: ["./tsconfig.json"],
tsconfigRootDir: __dirname,
extraFileExtensions: [".vue"],
},
???: [],
????: {
ecmaVersion: "??",
sourceType: "??",
},
????: ["vue", "@typescript-eslint"],
};</pre>
<p>? vue ??? ???? ?? ?????? ts ???? ???? Lint ??? ????. ?????? ??? ???? ??? ? ????. ??? ?? ?????. </p>
<p><code>parserOptions</code>? ???? ??? <code>@typescript-eslint/parser</code>? ???? ts ??? ???? ??? ????? vue ??? ??? ????. . </p>
<p>??? ? ????? </p>
?? ?? ? ?? ? ?? ??? ????.
-
will解析器:“vue-eslint-parser”
更改為@typescript-eslint/parser
-
.ts ??? ?? ???? ???? ??? @typescript-eslint/parser
? ?????.
?? +0
P粉739706089
?? ????? ?? ??? ??. ??? ??? ?? Lint ??? ? ?? parserOptions
??? ??? ????. ??? ?? ?? ?????:
???
?? +0
P粉739706089