microsoft / vscode-htmlhint

VS Code integration of HTMLHint, an HTML linter.
MIT License
50 stars 35 forks source link

HTMLhint now complains about Doctype, ignores .htmlhintrc #22

Open dbaeumer opened 7 years ago

dbaeumer commented 7 years ago

From @smlombardi on January 17, 2017 17:13

Extension Author Version
material-icon-theme PKief 1.2.0
code-settings-sync Shan 2.4.2
sort-lines Tyriar 1.1.0
html-css-class-completion Zignd 1.0.3
Bookmarks alefragnani 0.10.2
project-manager alefragnani 0.13.0
vscode-angular-files alexiv 1.3.7
one-monokai azemoh 0.2.4
vscode-icontheme-nomo-dark be5invis 1.2.5
vscode-eslint dbaeumer 1.2.2
githistory donjayamanne 0.1.5
tslint eg2 0.8.1
vscode-great-icons emmanuelbeziat 1.1.38
Angular2 johnpapa 1.0.2
theme-karyfoundation-themes karyfoundation 10.3.0
ftp-sync lukasz-wronski 0.3.2
HTMLHint mkaufman 0.3.3
vscode-csscomb mrmlnc 4.0.0
vscode-postcss-sorting mrmlnc 2.2.0
vscode-stylefmt mrmlnc 2.2.2
Theme-1337 ms-vscode 0.1.2
angular2-inline natewallace 0.0.17
nonbreakingspace smlombardi 0.0.1
vscode-icons robertohuertasm 7.0.1
stylelint shinnn 0.21.2
darcula-extended smlombardi 3.2.0
theme-tesla smlombardi 6.0.0
change-case wmaurer 1.0.0

Steps to Reproduce:

Prior to the most recent Insiders update I did not have this issue

  1. open an html file fragment, e.g. code meant to be used as an include or an AngularJS view, which has no Doctype, html, head or body tags
  2. gives you a warning: screen shot 2017-01-17 at 12 08 49 pm

My project has an .htmlhintrc file which says not to apply this rule:

{
    "tagname-lowercase": true,
    "attr-lowercase": ["viewBox", "test"],
    "attr-value-double-quotes": true,
    "doctype-first": false,
    "tag-pair": true,
    "spec-char-escape": true,
    "id-unique": true,
    "src-not-empty": true,
    "attr-no-duplication": true,
    "style-disabled": false
}

But I get the error anyway.

Copied from original issue: Microsoft/vscode#18678

warent commented 6 years ago

Any plans on fixing this? It's making the extension unusable for me since I'm editing templates within Vue components

EDIT: I found a workaround, just add the rules manually in your vscode settings

"htmlhint.options": {
    "doctype-first": false
}

Less than ideal but at least it's usable now :)

dreamalligator commented 6 years ago

I get this same issue, but I'm just using the CLI fyi. Likely an issue upstream with htmlhint :+1:

Sarabadu commented 4 years ago

@amin125 you need to set all the options "htmlhint.options": { "tagname-lowercase": true, "attr-lowercase": true, "attr-value-double-quotes": true, "doctype-first": false, "tag-pair": true, "spec-char-escape": true, "id-unique": true, "src-not-empty": true, "attr-no-duplication": true, "title-require": true },