Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 837 Bytes

use-nesting.md

File metadata and controls

63 lines (46 loc) · 837 Bytes

Pattern: Missing use of nesting

Issue: -

Description

Enforces nesting when it is possible in CSS.

Examples

always

If the first option is "always" or true, then [Stylelint Use Nesting] requires all nodes to be linted, and the following patterns are not considered violations:

.example {
  color: blue;

  &:hover {
    color: rebeccapurple;
  }
}
.example {
  color: blue;

  @media (min-width: 640px) {
    color: rebeccapurple;
  }
}

While the following patterns are considered violations:

.example {
  color: blue;
}

.example:hover {
  color: rebeccapurple;
}
.example {
  color: blue;
}

@media (min-width: 640px) {
  .example {
    color: rebeccapurple;
  }
}

Further Reading