Skip to content

declaration-no-important

Reports a declaration that ends in !important.

!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.

Reported
a { color: red !important; margin: 0 ! important; padding: 0 }
@keyframes k {
from { color: red }
to { color: blue !important }
}
css:
lint:
rules:
declaration-no-important: warn # off (default), warn, error
less:
lint:
rules:
declaration-no-important: warn # off (default), warn, error
scss:
lint:
rules:
declaration-no-important: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line declaration-no-important in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint declaration-no-important full