Skip to main content

declaration-no-important

禁止在声明中使用 !important

¥Disallow !important within declarations.

a { color: pink !important; }
/** ↑

* This !important */

如果你始终希望在声明中使用 !important,例如 如果你正在编写 用户风格,则可以使用 postcss-safe-important 安全地添加它们。

¥If you always want !important in your declarations, e.g. if you're writing user styles, you can safely add them using postcss-safe-important.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a { color: pink !important; }
a { color: pink ! important; }
a { color: pink!important; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { color: pink; }