A stylelint to catch mergeable selectors.
This rule will cause stylelint to warn when you either forget to nest or nest unnecessarily.
npm install stylelint-selector-no-mergeable
This plugin is compatible with v5.0.1+.
There are two major pieces to this plugin. Catching missed opportunities to nest rules (under-nesting), and catching over-usage of nesting (over-nesting).
Here are some examples of 'under-nesting':
/* Not OK *//* OK */}
/* Not OK */&&/* OK */&}
Here is an example of 'over-nesting':
If you would like to disable these 'over-nesting' errors, you can set the following option:
"stylelint-selector-no-mergeable" to your stylelint config
plugins array, then add
selector-no-mergeable to your rules, with your desired options.
"plugins":"stylelint-selector-no-mergeable""rules":"selector-no-mergeable": true "allowVanityNesting": true|false;
NOTE: This plugins currently finds mergeable PARENT selectors:
a .class1 a .class2
It does NOT, unfortunately, detect mergeable chained selectors:
This will hopefully come in a newer release, but will require quite a bit of testing.