1.说明
第八章有说明为什么安装eslint-plugin-vue
和vue-eslint-parser
。
这里同理需要安装@typescript-eslint/eslint-plugin
和@typescript-eslint/parser
。
2.安装TS的Lint
yarn add @typescript-eslint/eslint-plugin @typescript-eslint/parser --dev
3.将插件配置进ESLint
配置ESLint:根目录下修改:.eslintrc.js
文件。
module.exports = {
// ...
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2020,
sourceType: "module",
jsxPragma: "React",
ecmaFeatures: {
jsx: true,
tsx: true,
},
},
extends: ["plugin:vue/vue3-recommended", "plugin:@typescript-eslint/recommended"],
// ...
};
上一章
第八章-安装eslint-plugin-vue
下一章
第十章-安装eslint-plugin-prettier