Skip to content

attribute-empty-style

Reports an attribute whose empty value means the same as no value (hidden="", crossorigin="").

="" adds characters and no meaning, and the two spellings of the same thing make the files inconsistent.

To fix, write the attribute without ="".

Reported
...
<img src="a.png" alt="">
...
<p hidden="">x</p>
<p hidden>x</p>
...
angular:
lint:
rules:
attribute-empty-style: warn # off (default), warn, error
html:
lint:
rules:
attribute-empty-style: warn # off (default), warn, error
svelte:
lint:
rules:
attribute-empty-style: warn # off (default), warn, error
vue:
lint:
rules:
attribute-empty-style: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended.

Suppress one line with sudsy-disable-next-line attribute-empty-style 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-validate attribute-empty-style partial the omit style only, without the style option