6

VSCode is complaining about missing DOCTYPE on the html files. Meteor build system automatically adds file types and having them causes build errors. How do I make vscode to ignore missing doctype on html files?

Error I get for this.

Doctype must be declared first.
Kimmo Hintikka
  • 13,472
  • 7
  • 34
  • 63

2 Answers2

14

you need to create a .htmlhintrc in your root folder

you can go to http://htmlhint.com/ and setup the rules that are convient to you and create the .htmlhintrc

here is an example with "doctype-first": false,, which would ignore the error you're receiving, if that's your goal.

{
  "tagname-lowercase": true,
  "attr-lowercase": false,
  "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
}
ruffin
  • 16,507
  • 9
  • 88
  • 138
Sebastian Castaldi
  • 8,580
  • 3
  • 32
  • 24
5

Go to your VScode Preferences > Settings > HTML-Hint and add this:

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

André Bueno
  • 89
  • 1
  • 3
  • This is the right place to add settings, however, for myself, adding only the one rule turned off all the other rules. To get around this I added the JSON block from the acepted answer into `htmlhint.options` which seemed to do the trick. – Gabe Gates Sep 21 '21 at 15:56