Skip to content

attribute-boolean-style

Reports a boolean attribute that is written with a value (disabled="disabled", disabled=""). The attribute is true when it is present.

The value of a boolean attribute is not read: muted="false" still mutes. A value that looks like a switch invites that error, and the longer form says nothing more.

To fix, write the attribute alone (disabled). To turn it off, remove it.

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

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

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