2

I have an angular app and have just configured ESLint on the project and am getting this error on my index.html and it is complaining about a closing tag and not correctly reading this, I would like to ignore errors like this in the .html files. I am getting this error on the below tag

error Parsing error: '>' expected

index.html

<!doctype html>

Here is my esLinerc.json file

{
"env": {
    "browser": true,
    "es2021": true,
    "jasmine": true
},
"extends": [
    "eslint:recommended",
    "plugin:jasmine/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module"
},
"plugins": [
    "@typescript-eslint",
    "jasmine"
],
"ignorePatterns": [
    "/**/*.js",
    "**/vendor/*.js",
    "/**/*.component.html"
],
"rules": {
    "no-use-before-define": "off",
    "no-unused-vars": "off",
    "no-extra-boolean-cast": "off",
    "no-mixed-spaces-and-tabs": "off",
    "no-irregular-whitespace": "off",
   
"overrides": [
    {
        "files": ["*.component.html"],
        "parser": "@angular-eslint/template-parser",
        "parserOptions": {
          "project": "./tsconfig.app.json",
          "ecmaVersion": 2020,
          "sourceType": "module"
        },
        "rules": {
            "@typescript-eslint/dot-notation": "off",
            "@typescript-eslint/no-implied-eval": "off",
            "@typescript-eslint/no-throw-literal": "off",
            "strict": "off",
            "import/first": "off",
            "lines-around-directive": "off"
          },
        "plugins": ["@angular-eslint/template"]
      }
]

}

I had installed

"@typescript-eslint/eslint-plugin": "5.27.1", "@typescript-eslint/parser": "5.27.1",

earlier and read that i might have to install @angular-eslint/template-parser and have installed this as well ,

"@angular-eslint/template-parser": "^13.5.0", hoping that would ignore the bogus error and other errors where eslint is expecting a closing tag for component directives.

I have tried to add the **.html files as well to the ignore patterns but am still getting template errors that are not valid. Can someone please point out what exact i need to make to ignore errors on .html files

2
  • 1
    Did you make a mistake when you added html-files to ignorePatterns? It should work: "/**/*.html" Commented Aug 25, 2022 at 5:07
  • Hi @Eugene yes I ended up trying this and this worked, i thought i had to include "/**/*.component.html" but "/**/*.html" in ignorePatterns and it worked, Thanks for your help Commented Aug 25, 2022 at 19:27

3 Answers 3

1

You should ignore non-component html files. Just edit ignorePatterns section:

"ignorePatterns": [
  "/**/*.html",
],
Sign up to request clarification or add additional context in comments.

Comments

-1

Try this:

// eslint-disable-next-line

right before your html docutype

2 Comments

this doesnt work, i tried it both by adding // eslint-disable-next-line. and as a html comment like <!-- eslint-disable-next-line -->, I still get the error
are you sure your ESlint is configured correctly?
-1

Try to update from Android Studio if you have it, in the top menu click "Tools" > "Flutter" > "Flutter Upgrade".

Otherwise run "Flutter Upgrade -f"enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.