declaration-no-important
What it does
Section titled “What it does”Reports a declaration that ends in !important.
Why it matters
Section titled “Why it matters”!important breaks the cascade: only another !important with higher specificity can override it, so each use makes the next override harder and the stylesheet drifts into an arms race. Specificity and source order should decide.
To fix, raise the specificity of the selector that should win, or reorder the rules.
Example
Section titled “Example”a { color: red !important; margin: 0 ! important; padding: 0 }@keyframes k { from { color: red } to { color: blue !important }}Configuration
Section titled “Configuration”css: lint: rules: declaration-no-important: warn # off (default), warn, errorless: lint: rules: declaration-no-important: warn # off (default), warn, errorscss: lint: rules: declaration-no-important: warn # off (default), warn, errorSuppress one line with sudsy-disable-next-line declaration-no-important in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | declaration-no-important |
full |