noDuplicateClasses (HTML)
Summary
Section titled “Summary”- Rule available since:
v2.4.0 - Diagnostic Category:
assist/source/noDuplicateClasses - Sources:
- Inspired from
better-tailwindcss/no-duplicate-classes
- Inspired from
How to enable in your editor
Section titled “How to enable in your editor”{ "editor.codeActionsOnSave": { "source.action.noDuplicateClasses.biome": "explicit", "source.fixAll.biome": "explicit" }}{ "code_actions_on_format": { "source.action.noDuplicateClasses.biome": true, "source.fixAll.biome": true }}
Use the source action code
source.action.noDuplicateClasses.biome How to configure
Section titled “How to configure”{ "assist": { "actions": { "source": { "noDuplicateClasses": "on" } } }}Description
Section titled “Description”Remove repeated CSS class names from HTML class attributes.
Duplicate class names do not change the rendered style and often indicate a copy-and-paste mistake or merge conflict. The action keeps the first occurrence and removes later repeats.
Examples
Section titled “Examples”<div class="flex flex"></div>code-block.html ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 │ <div·class="flex·flex"></div>
│ -----
<div class="p-4 text-red-500 p-4 bg-white"></div>code-block.html ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 │ <div·class="p-4·text-red-500·p-4·bg-white"></div>
│ ----
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.