Skip to content

noValueAtRule

诊断类别:lint/nursery/noValueAtRule

¥Diagnostic Category: lint/nursery/noValueAtRule

自从:v1.8.0

¥Since: v1.8.0

禁止在 css 模块中使用 @value 规则。

¥Disallow use of @value rule in css modules.

建议使用 CSS 变量而不是 @value 规则。

¥Use of CSS variables is recommended instead of @value rule.

¥Examples

¥Invalid

@value red: #FF0000;
code-block.css:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

@value at-rule is not a standard CSS feature.

> 1 │ @value red: #FF0000;
^^^^^
2 │

You can enable @value at-rule parsing by setting the css.parser.cssModules option to true in your configuration file.

¥Valid

:root {
--red: #FF0000
}
p {
background-color: var(--red);
}

¥Related links