nesting-selector-no-missing-scoping-root
Disallow missing scoping root for nesting selectors.
& {}
/** ↑
* This nesting selector */
Use this rule to avoid styling the root element by mistake. Browsers resolve & outside a nested rule to the root element, as there is no parent to refer to.
This rule doesn't have any message arguments.
Options
true
{
"nesting-selector-no-missing-scoping-root": true
}
The following patterns are considered problems:
& {}
@media all {
& {}
}
@scope (&) {}
The following patterns are not considered problems:
a {
& {}
}
a {
@media all {
& {}
}
}
a {
@scope (&) {}
}
Optional secondary options
ignoreAtRules
{ "ignoreAtRules": ["array", "of", "at-rules", "/regex/"] }
Ignore nesting selectors within specified at-rules.
Given:
{
"nesting-selector-no-missing-scoping-root": [
true,
{ "ignoreAtRules": ["--foo", "/^--bar-/"] }
]
}
The following patterns are not considered problems:
@--foo {
& {}
}
@--bar-baz qux {
& {}
}