no-duplicate-class
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: offhtml/html-validate-recommended
What it does
Section titled “What it does”Reports a class name written twice in one class attribute.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”<a class="a {{ if x }}b{{ end }} {{ if y }}b{{ end }}">t</a><a class="a a">t</a>Configuration
Section titled “Configuration”angular: lint: rules: no-duplicate-class: warn # off (default), warn, errorhtml: lint: rules: no-duplicate-class: warn # off (default), warn, errorsvelte: lint: rules: no-duplicate-class: warn # off (default), warn, errorvue: lint: rules: no-duplicate-class: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |