Rule nesting-depth
will enforce how deeply a selector can be nested.
max-depth
: number (defaults to2
)
When enabled (assuming max-depth: 2
) the deepest element (&:hover
and &--modifier
) are at at depth 2. Any nested selector deeper is disallowed:
.foo {
.baz {
&:hover {
// Deepest Nest Allowed
}
}
}
.block {
&__element {
&--modifier {
// Deepest Nest Allowed
}
}
}