I found this sass feature as hard to catch some missing styles and would like to lint my project on it. Here is the link to feature documentation: https://sass-lang.com/documentation/style-rules/parent-selector#adding-suffixes
You can configure Stylelint'sselector-disallowed-list
rule to disallow concatenated selectors.
For example, to disallow the suffix examples in the Sass docs you can use:
{
"rules": {
"selector-disallowed-list": ["/^&__/", "/^&--/"]
}
}
This will disallow selectors that start with &__
or &--
, eg:
.foo {
&__bar {}
&--baz {}
}
But not:
.foo {
&::before {}
&:hover {}
& .bar {}
&.baz {}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.