Skip to content

missing-doctype

Reports a document that has no doctype, on its start. Not in .vue, .svelte and *.component.html files, which are fragments of a page.

A document with no doctype is rendered in quirks mode, which keeps old browser layout bugs alive and changes how boxes and tables are sized.

To fix, put <!DOCTYPE html> on the first line.

Reported
<title>x</title>
angular:
lint:
rules:
missing-doctype: warn # off (default), warn, error
html:
lint:
rules:
missing-doctype: warn # off (default), warn, error
svelte:
lint:
rules:
missing-doctype: warn # off (default), warn, error
vue:
lint:
rules:
missing-doctype: warn # off (default), warn, error

Enabled by the presets: html/htmlhint, html/html-eslint-recommended.

Suppress one line with sudsy-disable-next-line missing-doctype in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-eslint require-doctype full
html-validate missing-doctype full
htmlhint doctype-first partial the doctype is not required to be the first thing in the file