Skip to content

Files

Latest commit

 

History

History
67 lines (48 loc) · 1.01 KB

selector-nested-pattern.md

File metadata and controls

67 lines (48 loc) · 1.01 KB

Pattern: Invalid nested selector

Issue: -

Description

Specify a pattern for the selectors of rules nested within rules. Non-standard selectors (e.g. selectors with Sass or Less interpolation) and selectors of rules nested within at-rules are ignored.

Examples

regex|string

A string will be translated into a RegExp — new RegExp(someString) — so be sure to escape properly.

The selector value will be checked in its entirety. If you'd like to allow for combinators and commas, you must incorporate them into your pattern.

Given the string:

"^&:(?:hover|focus)$"

The following patterns are considered violations:

a {
  .bar {}
}
a {
  .bar:hover {}
}
a {
  &:hover,
  &:focus {}
}

The following patterns are not considered violations:

a {
  &:hover {}
}
a {
  &:focus {}
}
a {
  &:hover {}
  &:focus {}
}

Further Reading