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|regex
:["array", "of", "unprefixed", /functions/, "/regex/"]|"function"|"/regex/"|/regex/
如果字符串被 "/"
包围(例如 "/^rgb/"
),则它被解释为正则表达式。
¥If a string is surrounded with "/"
(e.g. "/^rgb/"
), it is interpreted as a regular expression.
鉴于:
¥Given:
["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
:["array", "of", "unprefixed", /functions/, "/regex/"]|"function"|"/regex/"|/regex/
如果匹配的函数在同一个声明块中没有属性回退,则不允许使用它们。
¥Disallow the matching functions when they are without a property fallback in the same declaration block.
鉴于:
¥Given:
["min", "/max/"]
例如,以 ["scale", "min", "/max/"]
作为主要选项。
¥For example, with ["scale", "min", "/max/"]
as the primary option.
以下模式被视为问题:
¥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);
}