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
CodePudding user response:
Try this:
// eslint-disable-next-line
right before your html docutype
CodePudding user response:
You should ignore non-component html
files. Just edit ignorePatterns
section:
"ignorePatterns": [
"/**/*.html",
],