function-allowed-list
指定允许的函数列表。
¥Specify a list of allowed functions.
a { transform: scale(1); }
/** ↑
* This function */
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
Array<string>
["array", "of", "unprefixed", "functions", "/regex/"]
鉴于:
¥Given:
{
"function-allowed-list": ["scale", "rgba", "/linear-gradient/"]
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { transform: rotate(1); }
a {
color: hsla(170, 50%, 45%, 1)
}
a {
background:
red,
-webkit-radial-gradient(red, green, blue);
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { background: red; }
a { transform: scale(1); }
a {
color: rgba(0, 0, 0, 0.5);
}
a {
background:
red,
-moz-linear-gradient(45deg, blue, red);
}
可选的辅助选项
¥Optional secondary options
exceptWithoutPropertyFallback
{
"exceptWithoutPropertyFallback": [
"array",
"of",
"unprefixed",
"functions",
"/regex/"
]
}
如果匹配的函数在同一个声明块中没有属性回退,则不允许使用它们。
¥Disallow the matching functions when they are without a property fallback in the same declaration block.
鉴于:
¥Given:
{
"function-allowed-list": [
["scale", "min", "/max/"],
{ "exceptWithoutPropertyFallback": ["min", "/max/"] }
]
}
以下模式被视为问题:
¥The following patterns are considered problems:
a { width: min(50%, 100px); }
a { height: max(50%, 100px); }
a {
width: max(50%, 100px);
width: 100px;
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { transform: scale(1); }
a {
width: 100px;
width: min(50%, 100px);
}