简体   繁体   English

将 @angular-eslint/template/eqeqeq 设置为 off 不适用于 angular 13

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

Setting the "@angular-eslint/template/eqeqeq": "off" , configuration on the .eslintrc.json doesn't work with angular 13设置"@angular-eslint/template/eqeqeq": "off".eslintrc.json上的配置不适用于 angular 13

.eslintrc.json .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": {}
    }
  ]
}

exception例外

/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

You apply this rule to *.ts files, but you need to apply it to the *.html files, because it is a rule for template files.您将此规则应用于*.ts文件,但您需要将其应用于*.html文件,因为它是模板文件的规则。 So simply move the rule to the HTML block.因此,只需将规则移至 HTML 块即可。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在@angular-eslint/template 中使用缩进规则 - use of indent rule in @angular-eslint/template 如何添加@angular-eslint/schematics? 错误 - How add @angular-eslint/schematics? Error Angular 9 + eslint:找不到规则“@angular-eslint/…”的错误定义 - Angular 9 + eslint: error Definition for rule '@angular-eslint/…' was not found 升级到 Angular 13 时从 @angular-eslint/schematics@12.6.1 接收对等 @angular/cli@&quot;&gt;= 12.0.0 &lt; 13.0.0&quot; - Receiving peer @angular/cli@">= 12.0.0 < 13.0.0" from @angular-eslint/schematics@12.6.1 when upgrading to Angular 13 如何运行@angular-eslint/schematics:convert-tslint-to-eslint - How to run @angular-eslint/schematics:convert-tslint-to-eslint angular-eslint 和 typescript-eslint 之间的区别 - Difference between angular-eslint and typescript-eslint @angular-eslint/no-input-rename ESLint 规则有什么意义? - What is the point of the @angular-eslint/no-input-rename ESLint rule? ESlint &amp; Angular 13: 无法关闭 typescript-eslint/typedef - ESlint & Angular 13: Unable to turn off typescript-eslint/typedef 如何为 protractor 项目设置 angular-eslint? - How do I need to setup angular-eslint for a protractor project? 如何防止规则 `@angular-eslint/template/i18n` 掉落 `mat-icon` 元素 - How to prevent rule `@angular-eslint/template/i18n` from linting `mat-icon` elements
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM