Home > OS >  Setting @angular-eslint/template/eqeqeq to off not working with angular 13
Setting @angular-eslint/template/eqeqeq to off not working with angular 13

Time:11-27

Setting the "@angular-eslint/template/eqeqeq": "off", configuration on the .eslintrc.json doesn't work with 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": {}
    }
  ]
}

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

CodePudding user response:

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. So simply move the rule to the HTML block.

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