Skip to content

noUnknownProperty

诊断类别:lint/correctness/noUnknownProperty

¥Diagnostic Category: lint/correctness/noUnknownProperty

自从:v1.8.0

¥Since: v1.8.0

来源:

¥Sources:

禁止未知的属性。

¥Disallow unknown properties.

此规则认为 CSS 规范中定义的属性和浏览器特定属性是已知的。https://github.com/known-css/known-css-properties#source

¥This rule considers properties defined in the CSS Specifications and browser specific properties to be known. https://github.com/known-css/known-css-properties#source

此规则忽略:

¥This rule ignores:

  • 自定义变量,例如 --custom-property

    ¥custom variables e.g. --custom-property

  • 供应商前缀属性(例如,-moz-align-self, -webkit-align-self

    ¥vendor-prefixed properties (e.g., -moz-align-self, -webkit-align-self)

¥Examples

¥Invalid

a {
colr: blue;
}
code-block.css:2:3 lint/correctness/noUnknownProperty ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unknown property is not allowed.

1 │ a {
> 2 │ colr: blue;
^^^^
3 │ }
4 │

See CSS Specifications and browser specific properties for more details.

To resolve this issue, replace the unknown property with a valid CSS property.

a {
my-property: 1;
}
code-block.css:2:3 lint/correctness/noUnknownProperty ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unknown property is not allowed.

1 │ a {
> 2 │ my-property: 1;
^^^^^^^^^^^
3 │ }
4 │

See CSS Specifications and browser specific properties for more details.

To resolve this issue, replace the unknown property with a valid CSS property.

¥Valid

a {
color: green;
}
a {
fill: black;
}
a {
-moz-align-self: center;
}

¥Related links