eslint error in html file: Parsing error: Unexpected token <

Viewed 3384

why eslint give me this error Parsing error: Unexpected token < in html file? how can i solve this error? my .eslint.json configs:

{
    "env": {
        "browser": true,
        "commonjs": true,
        "es2021": true
        },
    "extends": [
        "airbnb-base"
    ],
    "parserOptions": {
        "ecmaVersion": 12
    },
    "rules": {
        "strict": "off"
    }
}

3 Answers

Adding the below to ".eslintrc.json" file worked for me:

"ignorePatterns": [
  "**/*.html"
]

One other option can be to add an .eslintignorefile. See the exmple below.

.eslintignore

.vscode/*
dist/*
assets/*
node_modules/*
**/index.html
**/index.*.html
**/assets/*.html
Related