相关疑难解决方法(0)

尝试对 Angular 模板进行 lint 时出现 ESLint 错误

我有一个使用 eslint 和 prettier 设置的 Angular 10 应用程序,到目前为止它可以很好地处理 Typescript 文件。我现在正在尝试按照此文档整理我的组件模板文件。

但是当我运行它时,eslint . --ext .js,.ts,.component.html --fix我不断得到

Error while loading rule '@typescript-eslint/dot-notation': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Run Code Online (Sandbox Code Playgroud)

我的.eslintrc.js看起来像这样(注意本overrides节中的第二个块):

module.exports = {
  extends: [
    "plugin:@angular-eslint/recommended",
    // For spec files
    "plugin:jasmine/recommended",
    // AirBnB Styleguide rules
    "airbnb-typescript/base",
    // Settings for Prettier
    "prettier/@typescript-eslint",
    "plugin:prettier/recommended",
  ],
  plugins: [
    "prettier",
    "jasmine",
  ], …
Run Code Online (Sandbox Code Playgroud)

typescript eslint angular typescript-eslint

4
推荐指数
1
解决办法
8632
查看次数

标签 统计

angular ×1

eslint ×1

typescript ×1

typescript-eslint ×1