Skip to main content

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);
}