# Rule: No SLDS Class Overrides **Rule ID:** `slds/no-slds-class-overrides` **Severity:** Warning **Scope:** Detects CSS selectors that directly target `.slds-*` classes. --- ## What the Linter Does The linter detects CSS classes that directly override SLDS classes and reports them as **warnings**. It does **not** auto-fix — all changes require manual work in both CSS and HTML. ``` 1:1 warning Overriding slds-button isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button. slds/no-slds-class-overrides ``` **Manual steps required:** 1. Rename `.slds-*` selectors in CSS to `{componentName}-{sldsElementPart}` 2. Add the new component class to markup (`.html` for LWC, `.cmp` for Aura) **alongside** the original SLDS class 3. Never remove the original SLDS class from markup --- ## Naming Convention **Format:** `{componentName}-{sldsElementPart}` (camelCase component name) | SLDS Class | Component: `userProfile` | Result | |---|---|---| | `.slds-button` | `userProfile` | `userProfile-button` | | `.slds-card` | `userProfile` | `userProfile-card` | | `.slds-modal__content` | `userProfile` | `userProfile-modal__content` | | `.slds-button_brand` | `userProfile` | `userProfile-button_brand` | --- ## Common Patterns ### Pattern 1: Simple Selector ```css /* Before CSS */ .slds-button { border-radius: 8px; } /* After CSS */ .myComponent-button { border-radius: 8px; } ``` ```html ``` ### Pattern 2: Descendant Selector ```css /* Before CSS */ .slds-card .slds-button { margin-top: 1rem; } /* After CSS */ .myComponent-card .myComponent-button { margin-top: 1rem; } ``` ```html