Skip to main content

custom-property-no-missing-var-function

禁止自定义属性缺少 var 函数。

¥Disallow missing var function for custom properties.

    :root { --foo: red; }
a { color: --foo; }
/** ↑

* This custom property */

此规则有以下限制:

¥This rule has the following limitations:

  • 它仅报告在同一源中定义的自定义属性。

    ¥It only reports custom properties that are defined within the same source.

  • 它不检查可以包含作者定义的标识符的属性,例如 transition-property

    ¥It does not check properties that can contain author-defined identifiers, e.g. transition-property.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

:root { --foo: red; }
a { color: --foo; }
@property --foo {}
a { color: --foo; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

:root { --foo: red; }
a { color: var(--foo); }
@property --foo {}
a { color: var(--foo); }
@property --foo {}
a { transition-property: --foo; }