Skip to content

noDuplicateClasses (HTML)

.vscode/settings.json
{
"editor.codeActionsOnSave": {
"source.action.noDuplicateClasses.biome": "explicit",
"source.fixAll.biome": "explicit"
}
}
biome.json
{
"assist": {
"actions": {
"source": {
"noDuplicateClasses": "on"
}
}
}
}

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.

<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>
│ ----