簡體   English   中英

將 @angular-eslint/template/eqeqeq 設置為 off 不適用於 angular 13

[英]Setting @angular-eslint/template/eqeqeq to off not working with angular 13

設置"@angular-eslint/template/eqeqeq": "off".eslintrc.json上的配置不適用於 angular 13

.eslintrc.json

    {
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.ts"
      ],
      "parserOptions": {
        "project": [
          "tsconfig.json",
          "e2e/tsconfig.json"
        ],
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@angular-eslint/recommended",
        "plugin:@angular-eslint/template/process-inline-templates",
        "prettier"
      ],
      "plugins": ["prettier"],
      "rules": {
        "@angular-eslint/component-selector": [
          "error",
          {
            // "prefix": "app",
            "style": "kebab-case",
            "type": "element"
          }
        ],
        "@angular-eslint/directive-selector": [
          "error",
          {
            // "prefix": "app",
            "style": "camelCase",
            "type": "attribute"
          }
        ],
        "@angular-eslint/template/eqeqeq": "off",
        "@angular-eslint/no-host-metadata-property": "off",
        "@angular-eslint/no-output-on-prefix": "off",
        "@angular-eslint/no-output-native":"off"
        // "@angular-eslint/template/eqeqeq":[
        //   "error",{
        //     "allow-static": true
        //   }
        // ],
        // "prettier/prettier": ["error", { "parser": "angular" }]
      }
    },
    {
      "files": [
        "*.html"
      ],
      "extends": [
        "plugin:@angular-eslint/template/recommended"
      ],
      "rules": {}
    }
  ]
}

例外

/Users/macbook/Projects/6clicks/src/LegalRegTech.Web.Host/src/app/main/rb-assessment/rba-details/rba-details.component.html
  12:33  error  Expected `===` but received `==`  @angular-eslint/template/eqeqeq
  15:33  error  Expected `===` but received `==`  @angular-eslint/template/eqeqeq
  19:45  error  Expected `!==` but received `!=`  @angular-eslint/template/eqeqeq
  75:21  error  Expected `===` but received `==`  @angular-eslint/template/eqeqeq
  78:21  error  Expected `===` but received `==`  @angular-eslint/template/eqeqeq

您將此規則應用於*.ts文件,但您需要將其應用於*.html文件,因為它是模板文件的規則。 因此,只需將規則移至 HTML 塊即可。

{
  "files": [
    "*.html"
  ],
  "extends": [
    "plugin:@angular-eslint/template/recommended"
  ],
  "rules": {
    "@angular-eslint/template/eqeqeq": "off"
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM