Skip to main content

value-keyword-case

指定关键字值的小写或大写。

¥Specify lowercase or uppercase for keywords values.

    a { display: block; }
/** ↑

* These values */

此规则忽略 <custom-idents> 个已知属性。与非属性(例如 $vars 和自定义属性)配对且不符合主要选项的关键字值可以使用 ignoreKeywords: [] 辅助选项忽略。

¥This rule ignores <custom-idents> of known properties. Keyword values which are paired with non-properties (e.g. $vars and custom properties), and do not conform to the primary option, can be ignored using the ignoreKeywords: [] secondary option.

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

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

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

"lower"

{
"value-keyword-case": "lower"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
display: Block;
}
a {
display: bLoCk;
}
a {
display: BLOCK;
}
a {
transition: -WEBKIT-TRANSFORM 2s;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: block;
}
a {
transition: -webkit-transform 2s;
}

"upper"

{
"value-keyword-case": "upper"
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
display: Block;
}
a {
display: bLoCk;
}
a {
display: block;
}
a {
transition: -webkit-transform 2s;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: BLOCK;
}
a {
transition: -WEBKIT-TRANSFORM 2s;
}

可选的辅助选项

¥Optional secondary options

ignoreKeywords

{ "ignoreKeywords": ["array", "of", "keywords", "/regex/"] }

忽略关键字值的大小写。

¥Ignore case of keywords values.

鉴于:

¥Given:

{
"value-keyword-case": [
"lower",
{ "ignoreKeywords": ["Block", "/^(f|F)lex$/"] }
]
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
display: bLoCk;
}
a {
display: BLOCK;
}
a {
display: fLeX;
}
a {
display: FLEX;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: block;
}
a {
display: Block;
}
a {
display: flex;
}
a {
display: Flex;
}

ignoreProperties

{ "ignoreProperties": ["array", "of", "properties", "/regex/"] }

忽略列出的属性值的大小写。

¥Ignore case of the values of the listed properties.

鉴于:

¥Given:

{
"value-keyword-case": [
"lower",
{ "ignoreProperties": ["/^(b|B)ackground$/", "display"] }
]
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
text-align: LEFT;
}
a {
text-align: Left;
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: bloCk;
}
a {
display: BloCk;
}
a {
display: BLOCK;
}
a {
display: block;
}
a {
background: Red;
}
a {
Background: deepPink;
}

ignoreFunctions

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

忽略列出的函数内值的大小写。

¥Ignore case of the values inside the listed functions.

鉴于:

¥Given:

{
"value-keyword-case": ["upper", { "ignoreFunctions": ["/^(f|F)oo$/", "t"] }]
}

以下模式被视为问题:

¥The following patterns are considered problems:

a {
display: b(inline);
}
a {
color: bar(--camelCase);
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
display: t(flex);
}
a {
display: t(fLeX);
}
a {
color: t(--camelCase);
}
a {
color: foo(--camelCase);
}
a {
color: Foo(--camelCase);
}

camelCaseSvgKeywords

如果是 true,则当主要选项是 "lower" 时,此规则期望 SVG 关键字为驼峰式大小写。默认为 false

¥If true, this rule expects SVG keywords to be camel case when the primary option is "lower". Defaults to false.

鉴于:

¥Given:

{
"value-keyword-case": ["lower", { "camelCaseSvgKeywords": true }]
}

以下模式不被视为问题:

¥The following pattern is not considered a problem:

a {
color: currentColor;
}

以下模式被认为是一个问题:

¥The following pattern is considered a problem:

a {
color: currentcolor;
}