跳到主要內容

property-no-unknown

禁止未知屬性。

a { height: 100%; }
/** ↑
* This property */

此規則將 CSS 規格和特定瀏覽器屬性 中定義的屬性視為已知。

此規則會忽略

  • 變數 ($sass@less--custom-property)
  • 供應商前綴屬性 (例如,-moz-align-self-webkit-align-self)

使用下方說明的 checkPrefixed 選項開啟供應商前綴屬性的檢查。

message 次要選項 可以接受此規則的參數。

選項

true

以下模式被視為問題

a {
colr: blue;
}
a {
my-property: 1;
}

以下模式不會被視為問題

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

選用的次要選項

ignoreProperties: ["/regex/", /regex/, "string"]

已提供

["/^my-/", "custom"]

以下模式不會被視為問題

a {
my-property: 10px;
}
a {
my-other-property: 10px;
}
a {
custom: 10px;
}

ignoreSelectors: ["/regex/", /regex/, "string"]

略過檢查此規則中給定選擇器的屬性。

已提供

[":root"]

以下模式不會被視為問題

:root {
my-property: blue;
}

ignoreAtRules: ["/regex/", /regex/, "string"]

忽略巢狀在指定 at 規則中的屬性。

已提供

["supports"]

以下模式不會被視為問題

@supports (display: grid) {
a {
my-property: 1;
}
}

checkPrefixed: true | false (預設:false)

如果為 true,此規則將檢查供應商前綴屬性。

例如,使用 true

以下模式不會被視為問題

a {
-webkit-overflow-scrolling: auto;
}
a {
-moz-box-flex: 0;
}

以下模式被視為問題

a {
-moz-align-self: center;
}
a {
-moz-overflow-scrolling: center;
}