emyy96
emyy96

Reputation: 309

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

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"
    }
}

Upvotes: 12

Views: 9849

Answers (3)

Damien Golding
Damien Golding

Reputation: 1000

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

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

Upvotes: 6

Dan Marinescu
Dan Marinescu

Reputation: 25

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

Upvotes: 0

Emerzonik
Emerzonik

Reputation: 585

you need eslint-plugin-html to lint html file. the details can be found in this link: https://www.npmjs.com/package/eslint-plugin-html

Upvotes: 13

Related Questions