Skip to content

no-important

Reports utilities with the important modifier, such as p-4!.

This rule reports each use of a utility with the ! modifier once, even when it emits several important declarations. It also reports !important declarations in utility definitions. An important declaration wins over styles that would normally override it, which makes later changes harder. No preset enables this rule.

Reported

const base = style("p-2");
style(base, "p-4!");no-important: the `!` utility modifier is forbidden

Fixed

const base = style("p-2");
style(base, "p-4");

How to fix

  • To override a shared style, pass it as a base. The later utilities win without !, as in the example.
  • To win over a stylesheet that you do not control, use the important field of the project instead. See Configuration.

Rule settings

PresetSeverity
recommendedoff
strictoff
stylisticoff
OptionDefault
checkImplementationtrue

Configure lint to change the severity or options.