Interpret Your Results
Use SLDS Linter to find UI violations if you're working on SLDS 1, SLDS 2 or transitioning from SLDS 1 to SLDS 2. SARIF reports generated by SLDS Linter list all the identified UI violations for currently enabled rules and, when available, include recommendations. Autofix your code or use the recommendations to manually make changes. Open your code in VS Code and review the messages displayed in the SARIF report against the code, to determine which values must be updated or removed.
Here’s the good news! You don’t have to fix all the identified violations to align with SLDS 2 guidelines. Analyze these four types of errors to understand the impact of the identified issues and how to fix them.
| Error Type | Recommended Action | Effort Required to Fix | Examples |
|---|---|---|---|
| Design tokens |
| Little to no manual effort | Existing code: /* Using --slds-g-color-border-1 as fallback value for --lwc-color-background-1 is not supported. */ .example { color: var(--lwc-color-background-1, var(--slds-g-color-border-1)); } Recommended code: .example { color: var(--slds-g-color-border-1, var(--lwc-color-background-1)); } The --lwc-color-background-1 token is replaced with the --slds-g-color-border-1 styling hook. The --lwc token is mentioned as the fallback value. |
| Unsupported classes |
| Medium effort | Existing code:<span class="slds-icon_left"> </span> The slds-icon_left class is deprecated in SLDS 2 and must be updated to a class that is supported in SLDS 2. |
| Hard-coded values |
| High effort | Existing code: .THIS .container { color: #5c5c5c; border-color: #5c5c5c; }Recommended code: .THIS .container { color: var(--slds-g-color-on-surface-1,#5c5c5c); border-color:var(--slds-g-color-border-2,#5c5c5c); } In this example, the #5c5c5c hard-coded value for the color property is replaced with an on-surface semantic styling hook. The #5c5c5c hard-coded value for the border-color property is replaced with a color-border semantic styling hook |
| Unsupported hooks |
| Little to no effort | Existing Code:.THIS .action-link { color: var(--slds-g-link-color) } Here the --slds-g-link-color styling hook is deprecated. |
Remember that SLDS Linter results will change as your code changes. So, regularly test your code in a sandbox or User Acceptance Testing (UAT) environment and handle the identified issues using the information in this guide and our resources on the SLDS 2 site.
See Also