5

VSCode 抱怨 html 文件中缺少 DOCTYPE。Meteor 构建系统会自动添加文件类型并让它们导致构建错误。如何让 vscode 忽略 html 文件中缺少的 doctype?

我得到这个错误。

Doctype must be declared first.
4

2 回答 2

10

您需要在根文件夹中创建一个 .htmlhintrc

您可以访问http://htmlhint.com/并设置适合您的规则并创建 .htmlhintrc

这是一个带有 的示例"doctype-first": false,,如果这是您的目标,它将忽略您收到的错误。

{
  "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
}
于 2016-10-05T15:21:04.550 回答
5

转到您的 VScode Preferences > Settings > HTML-Hint 并添加以下内容:

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

于 2020-05-29T12:35:52.033 回答