noDuplicateClasses
Summary
Section titled “Summary”- 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 duplicate CSS classes.
Detects and removes duplicate CSS classes in HTML class attributes.
This action helps keep your class strings clean by detecting and removing duplicates.
Duplicate classes are redundant and can indicate copy-paste errors or merge conflicts.
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”Summary
Section titled “Summary”- 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 duplicate CSS classes.
Detects and removes duplicate CSS classes in JSX class and className attributes,
as well as in utility function calls like clsx, cn, cva, etc.
Duplicate classes are redundant and can indicate copy-paste errors or merge conflicts.
Examples
Section titled “Examples”<div class="flex flex" />;code-block.jsx ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 │ <div·class=“flex·flex”·/>;
│ -----
<div class="p-4 text-red-500 p-4 bg-white" />;code-block.jsx ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Source action diff:
1 │ <div·class=“p-4·text-red-500·p-4·bg-white”·/>;
│ ----
Options
Section titled “Options”Use the attributes option to specify additional JSX attributes to check.
Use the functions option to specify utility functions to check (e.g., clsx, cn, cva).
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.