@shopee-ads/selector-disallowed-list
v1.0.6
Published
stylelint plugin to disable nested or normal selectors list
Downloads
6
Maintainers
Readme
selector-disallowed-list
Specify a list of disallowed selectors.
.foo > .bar
/** ↑
* This is selector */
Options
array|string|regexp
: ["array", "of", "selectors", /or/, "/regex/"]|"selector"|"/regex/"|/regex/
If a string is surrounded with "/"
(e.g. "/\.foo/"
), it is interpreted as a regular expression.
Given:
["a > .foo", "/\\[data-.+]/"]
The following patterns are considered problems:
a > .foo {}
a[data-auto="1"] {}
.foo, [data-auto="1"] {}
The following patterns are not considered problems:
.foo {}
a
>
.foo {}
.bar > a > .foo {}
.data-auto {}
a[href] {}
Optional secondary options
resolveNestedSelectors: true | false
(default: false
)
This option will resolve nested selectors with &
interpolation.
For example, with true
.
Given the string:
"^\.[A-Z]+$"
The following patterns are considered problems:
.A {
&B {} /* resolved to ".AB" */
}
The following patterns are not considered problems:
.A {
&__B {} /* resolved to ".A__B" */
}
TODO
- [ ] 1. 支持正则