selector-nested-pattern
为规则中嵌套的规则选择器指定模式。
¥Specify a pattern for the selectors of rules nested within rules.
a {
color: orange;
&:hover { color: pink; } }
/** ↑
* This nested selector */
非标准选择器(例如使用 Sass 或 Less 插值的选择器)和嵌套在 at 规则中的规则选择器将被忽略。
¥Non-standard selectors (e.g. selectors with Sass or Less interpolation) and selectors of rules nested within at-rules are ignored.
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
regex|string
字符串将被转换为正则表达式,如 new RegExp(yourString)
— 因此请务必正确转义。
¥A string will be translated into a RegExp like so new RegExp(yourString)
— so be sure to escape properly.
将完整检查选择器值。如果你想允许使用组合符和逗号,则必须将它们合并到你的模式中。
¥The selector value will be checked in its entirety. If you'd like to allow for combinators and commas, you must incorporate them into your pattern.
给定字符串:
¥Given the string:
"^&:(?:hover|focus)$"
以下模式被视为问题:
¥The following patterns are considered problems:
a {
.bar {}
}
a {
.bar:hover {}
}
a {
&:hover,
&:focus {}
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
&:hover {}
}
a {
&:focus {}
}
a {
&:hover {}
&:focus {}
}
可选的辅助选项
¥Optional secondary options
splitList: true | false
(默认:false
)
¥splitList: true | false
(default: false
)
将选择器列表拆分为单独的选择器。
¥Split selector lists into individual selectors.
例如,true
。
¥For example, with true
.
给定字符串:
¥Given the string:
"^&:(?:hover|focus)$"
以下模式被视为问题:
¥The following patterns are considered problems:
a {
.bar:hover,
&:focus {}
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
&:hover,
&:focus {}
}