Home > front end >  ESLINT does not get syntax error from HML tag
ESLINT does not get syntax error from HML tag

Time:05-03

I'm doing some tests here with ESLINT and I noticed that it doesn't get an error when it's in the HTML tag.

Why does this happen? How to fix?

EXAMPLE?

Property 'h11' does not exist on type 'JSX.IntrinsicElements'.ts(2339)

export default function App() {
    return <h11>Hello World</h11>;
}


$ eslint "src/**/*.ts?(x)"
Done in 2.98s.

CodePudding user response:

h11 isn't a HTML tag, they go from h1 to h6. It's warning you that h11 isn't in the list of natural HTML tags.

To fix:

export default function App() {
    return <h1>Hello World</h1>;
}

CodePudding user response:

In /.vscode/settings.json

{
  "eslint.validate": [ "javascript", "html" ]
}

In .eslintrc.js

module.exports = {
  "env": {
    "browser": true,
    "es6": true
  },
  "plugins": [
    "eslint-plugin-html",
  ],
  "extends": "eslint:recommended",
  "rules": {
  }
};
  • Related