declaration-property-unit-allowed-list
宣言内で許可されるプロパティと単位のペアのリストを指定します。
a { width: 100px; }
/** ↑ ↑
* These properties and these units */
message
セカンダリオプションは、このルールの引数を受け入れることができます。
オプション
object
: { "プレフィックスなしのプロパティ名": ["単位", "の", "配列"]|"単位" }
プロパティ名が "/"
で囲まれている場合(例:"/^animation/"
)、正規表現として解釈されます。これにより、たとえば、ショートハンドを簡単にターゲットにすることができます。/^animation/
は、animation
、animation-duration
、animation-timing-function
などに一致します。
指定された場合
{
"font-size": ["em", "px"],
"/^animation/": "s",
"line-height": []
}
次のパターンは問題と見なされます
a { font-size: 1.2rem; }
a { animation: animation-name 500ms ease; }
a { -webkit-animation: animation-name 500ms ease; }
a { animation-duration: 500ms; }
a { line-height: 13px; }
次のパターンは問題とは見なされません
a { font-size: 1em; }
a { height: 100px; }
a { animation: animation-name 5s ease; }
a { -webkit-animation: animation-name 5s ease; }
a { animation-duration: 5s; }
a { line-height: 1; }
オプションのセカンダリオプション
ignore: ["inside-function"]
関数内にある単位を無視します。
たとえば、指定された場合
[
{
"/^border/": ["px"],
"/^background/": ["%"]
},
{
"ignore": ["inside-function"]
}
]
次のパターンは問題とは見なされません
a {
border: 1px solid hsla(162deg, 51%, 35%, 0.8);
}
a {
background-image: linear-gradient(hsla(162deg, 51%, 35%, 0.8), hsla(62deg, 51%, 35%, 0.8));
}