Skip to content

no-duplicate-class

Reports a class name written twice in one class attribute.

The second one does nothing, and it is usually left over from a merge or from a class that should have had another name.

To fix, remove the repeat.

Reported
<a class="a {{ if x }}b{{ end }} {{ if y }}b{{ end }}">t</a>
<a class="a a">t</a>
angular:
lint:
rules:
no-duplicate-class: warn # off (default), warn, error
html:
lint:
rules:
no-duplicate-class: warn # off (default), warn, error
svelte:
lint:
rules:
no-duplicate-class: warn # off (default), warn, error
vue:
lint:
rules:
no-duplicate-class: warn # off (default), warn, error

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

Suppress one line with sudsy-disable-next-line no-duplicate-class in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
html-eslint no-duplicate-class full
html-validate no-dup-class full