Empty attribute style

Rule ID:
attribute-empty-style
Category:
Style
Standards:
  • HTML5

Attributes without a value is implied to be an empty string by the HTML5 standard, e.g. <a download> and <a download=""> are equal. This rule requires a specific style when writing empty attributes. Default is to omit the empty string "".

This rule does not have an effect on boolean attributes, see attribute-boolean-style instead.

Rule details

Examples of incorrect code for this rule:

<a download=""></a>
error: Attribute "download" should omit value (attribute-empty-style) at inline:1:4:
> 1 | <a download=""></a>
    |    ^^^^^^^^


1 error found.

Examples of correct code for this rule:

<a download></a>

Options

This rule takes an optional object:

{
  "style": "omit"
}

Style