第九章-安装@typescript-eslint

1.说明

第八章有说明为什么安装eslint-plugin-vuevue-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

# vben  TS  ESLint 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×