src/content/docs/assist/actions/no-duplicate-classes.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components'; import EditorAction from "@/components/EditorAction.astro";
<Tabs> <TabItem label="HTML" icon="seti:html"> ## Summary - Rule available since: `v2.4.0` - Diagnostic Category: [`assist/source/noDuplicateClasses`](/reference/diagnostics#diagnostic-category) - Sources: - Inspired from [`better-tailwindcss/no-duplicate-classes`](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-duplicate-classes.md)## 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
```html
<div class="flex flex"></div>
<div class="p-4 text-red-500 p-4 bg-white"></div>
## 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
```jsx
<div class="flex flex" />;
<div class="p-4 text-red-500 p-4 bg-white" />;
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).