Skip to main content

function-name-case

指定函数名称的小写或大写。

¥Specify lowercase or uppercase for function names.

a { width: calc(5% - 10em); }
/** ↑

* This function */

驼峰式大小写函数名称,例如 使用 lower 选项时会考虑 translateX

¥Camel case function names, e.g. translateX, are accounted for when the lower option is used.

fix 选项 可以自动修复此规则报告的所有问题。

¥The fix option can automatically fix all of the problems reported by this rule.

选项

¥Options

"lower"

{
"function-name-case": "lower"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
width: Calc(5% - 10em);
}
a {
width: cAlC(5% - 10em);
}
a {
width: CALC(5% - 10em);
}
a {
background: -WEBKIT-RADIAL-GRADIENT(red, green, blue);
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
width: calc(5% - 10em);
}
a {
background: -webkit-radial-gradient(red, green, blue);
}

"upper"

{
"function-name-case": "upper"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
width: Calc(5% - 10em);
}
a {
width: cAlC(5% - 10em);
}
a {
width: calc(5% - 10em);
}
a {
background: -webkit-radial-gradient(red, green, blue);
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
width: CALC(5% - 10em);
}
a {
background: -WEBKIT-RADIAL-GRADIENT(red, green, blue);
}

可选的辅助选项

¥Optional secondary options

ignoreFunctions

{ "ignoreFunctions": ["array", "of", "functions", "/regex/"] }

忽略函数名称的大小写。

¥Ignore case of function names.

鉴于:

¥Given:

{
"function-name-case": [
"lower",
{ "ignoreFunctions": ["--some-function", "/^--get.*$/"] }
]
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
color: --sOmE-FuNcTiOn();
}
a {
color: --GetColor();
}
a {
color: --GET_COLOR();
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: --some-function();
}
a {
display: --getColor();
}
a {
display: --get_color();
}