skip to Main Content

As you may know VSCode’s extension HTMLHint has been deprecated. It was a great static analyzer for html files. None of the alternative extensions work correctly (htmllint, LintHTML, W3C Validation…).

Maybe you can suggest better alternatives?

2

Answers


  1. Chosen as BEST ANSWER

    I found a solution. You need to install HTML-validate. By default is doesn't works, additionally you need to install:

    npm install --global html-validate
    

    and restart your VSCode.

    If for you (as for me) is very annoying all validation rules, then you should create file .htmlvalidate.json into project root and fill it like this:

    { "elements": [ "html5" ], "extends": [ "html-validate:recommended" ], "rules": { "attr-delimiter": "off", "attr-spacing": "off", "doctype-html": "off", "meta-refresh": "off", "no-conditional-comment": "off", "no-deprecated-attr": "off", "no-redundant-for": "off", "no-redundant-role": "off", "no-style-tag": "off", "prefer-button": "warn", "prefer-tbody": "off", "tel-non-breaking": "off", "unrecognized-char-ref": "off", "attribute-allowed-values": "warn", "no-trailing-whitespace": "off", "no-inline-style": "off", "doctype-style": "off", "class-pattern": "off", "attribute-empty-style": "off", "attribute-boolean-style": "off", "attr-pattern": "off", "input-missing-label": "off", "no-autoplay": "off", "element-permitted-content": "off" } }

    All rules are here: HTML-rules


  2. I’m on the HTMLHint team and we recently published the official HTMLHint VS Code extension which is based on Microsoft’s deprecated one. Its bundled with the latest HTMLHint library so all rules are supported out of the box and we have more features and improvements planned!

    Download:
    https://marketplace.visualstudio.com/items?itemName=HTMLHint.vscode-htmlhint

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search