Require a specific style for closing void elements

Rule ID:
void-style
Category:
Style
Standards:
-

HTML void elements are elements which cannot have content. Void elements are implicitly closed (<img>) but may optionally be XML-style self-closed (<img/>).

This rules enforces usage of one of the two styles. Default is to omit self-closing tag.

This rule has no effect on non-void elements, see the related rule no-self-closing.

Rule details

Examples of incorrect code for this rule:

<input/>
error: Expected omitted end tag <input> instead of self-closing element <input/> (void-style) at inline:1:7:
> 1 | <input/>
    |       ^^


1 error found.

Examples of correct code for this rule:

<input>

Options

This rule takes an optional object:

{
  "style": "omit"
}

Style