Configuration presets

HTML-validate comes with a few predefined presets.

Presets can be configured using:

.htmlvalidate.json
{
  "extends": ["html-validate:PRESET"]
}

Multiple presets can be set and will be enabled in the order they appear in "extends". See configuration usage guide for more details.

Available presets

This is the default preset and enables most rules including standards validation, WCAG and best practices. It is a superset of the other presets.

html-validate:standard

Enables rules related to validating according to the WHATWG HTML standard (Living Standard).

Use this preset if you want validation similar to the Nu Html Checker and similar tools.

html-validate:prettier

If you are using Prettier to format your HTML markup you can use this preset to disable contradicting rules such as void-style.

This preset if meant to be used in combination with another preset such as html-validate:recommended as it only disables rules.

html-validate:a11y

Enables rules related to accessibility. Most rules but not all enabled rules relates to WCAG compliance. On its own it will not validate if the document/template itself is valid but only if accessibility issues can be found.

This preset should be used together with html-validate:standard to ensure the document structure is valid (a requirement of WCAG) and if possible html-validate:document (to ensure references are valid, etc).

html-validate:document

Enables rules requiring a full document to validate, i.e. not a partial template. Examples include missing doctype and invalid references.

Use this preset together with other presets for full coverage. This preset is enabled by plugins such as cypress-html-validate and protractor-html-validate.

Comparison

Rule recommended standard a11y document
allowed-links
area-alt
aria-hidden-body
aria-label-misuse
attr-case
attr-delimiter
attr-pattern
attr-quotes
attr-spacing
attribute-allowed-values
attribute-boolean-style
attribute-empty-style
attribute-misuse
class-pattern
close-attr
close-order
deprecated
deprecated-rule
doctype-html
doctype-style
element-case
element-name
element-permitted-content
element-permitted-occurrences
element-permitted-order
element-permitted-parent
element-required-ancestor
element-required-attributes
element-required-content
empty-heading
empty-title
form-dup-name
heading-level
hidden-focusable
id-pattern
input-attributes
input-missing-label
long-title
map-dup-name
map-id-name
meta-refresh
missing-doctype
multiple-labeled-controls
no-autoplay
no-conditional-comment
no-deprecated-attr
no-dup-attr
no-dup-class
no-dup-id
no-implicit-button-type
no-implicit-close
no-implicit-input-type
no-inline-style
no-missing-references
no-multiple-main
no-raw-characters
no-redundant-aria-label
no-redundant-for
no-redundant-role
no-self-closing
no-style-tag
no-trailing-whitespace
no-unknown-elements
no-unused-disable
no-utf8-bom
prefer-button
prefer-native-element
prefer-tbody
require-csp-nonce
require-sri
script-element
script-type
svg-focusable
tel-non-breaking
text-content
unique-landmark
unrecognized-char-ref
valid-id
void-content
void-style
wcag/h30
wcag/h32
wcag/h36
wcag/h37
wcag/h63
wcag/h67
wcag/h71