selector-no-qualifying-type
禁止按类型限定选择器。
¥Disallow qualifying a selector by type.
a.foo {}
/** ↑
* This type selector is qualifying the class */
当类型选择器与另一个选择器(例如 a.foo
、a#foo
)复合(链接)时,它是 "qualifying"。此规则不规范通过组合器与其他选择器组合的类型选择器(例如 a > .foo
、a #foo
)。
¥A type selector is "qualifying" when it is compounded with (chained to) another selector (e.g. a.foo
, a#foo
). This rule does not regulate type selectors that are combined with other selectors via a combinator (e.g. a > .foo
, a #foo
).
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
true
以下模式被视为问题:
¥The following patterns are considered problems:
a.foo {
margin: 0
}
a#foo {
margin: 0
}
input[type='button'] {
margin: 0
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
.foo {
margin: 0
}
#foo {
margin: 0
}
input {
margin: 0
}
可选的辅助选项
¥Optional secondary options
ignore: ["attribute", "class", "id"]
"attribute"
允许按类型限定属性选择器。
¥Allow attribute selectors qualified by type.
以下模式不被视为问题:
¥The following patterns are not considered problems:
input[type='button'] {
margin: 0
}
"class"
允许按类型限定类选择器。
¥Allow class selectors qualified by type.
以下模式不被视为问题:
¥The following patterns are not considered problems:
a.foo {
margin: 0
}
"id"
允许按类型限定 ID 选择器。
¥Allow ID selectors qualified by type.
以下模式不被视为问题:
¥The following patterns are not considered problems:
a#foo {
margin: 0
}