【问题标题】:Multiple `title` testing with `eslint` - is there a way使用`eslint`进行多个`title`测试-有没有办法
【发布时间】:2022-01-22 13:48:05
【问题描述】:

我有 2 个标题,每个标题都在后面。但我的eslint 不引发错误。我需要在我的..eslintrc.json 文件中添加更多配置吗?我还需要手动添加所有规则吗?

这是我的配置文件:

{
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.ts"
      ],
      "parserOptions": {
        "project": [
          "tsconfig.json"
        ],
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@angular-eslint/recommended",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "rules": {
        "@angular-eslint/directive-selector": [
          "error",
          {
            "type": "attribute",
            "prefix": "app",
            "style": "camelCase"
          }
        ],
        "@angular-eslint/component-selector": [
          "error",
          {
            "type": "element",
            "prefix": "app",
            "style": "kebab-case"
          }
        ]
      }
    },
    {
      "files": [
        "*.html"
      ],
      "extends": [
        "plugin:@angular-eslint/template/recommended"
      ],
      "rules": {
        "@angular-eslint/template/accessibility-alt-text": "error",
        "@angular-eslint/prefer-on-push-component-change-detection": "error",
        "@angular-eslint/no-pipe-impure": "error"
      }
    }
  ]
}

html:

<app-forecast></app-forecast>
<app-notification-list></app-notification-list>
<div class="container">
    <h1>Title one</h1>
    <h1>Title two</h1> //no error
    <img [src]="'https://picsum.photos/200/300'" />
    <div class="row">
        <div class="col-sm">
            <app-na-article-list></app-na-article-list>
        </div>
    </div>
</div>

【问题讨论】:

    标签: angular eslint eslintrc


    【解决方案1】:

    eslint 仅检查 linting 问题。上面的html代码是正确的,不会抛出任何错误。

    【讨论】:

    • 有没有办法扩展这个?
    猜你喜欢
    • 1970-01-01
    • 2019-01-23
    • 1970-01-01
    • 2019-10-06
    • 1970-01-01
    • 1970-01-01
    • 2021-07-14
    • 2014-08-11
    • 1970-01-01
    相关资源
    最近更新 更多