Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 1.15 KB

File metadata and controls

67 lines (52 loc) · 1.15 KB

at-root-no-redundant

Ban unnecessary @at-root rule.

The @at-root rule is redundant in the following cases:

  • If @at-root is already at the root of the document.
  • If any @at-root selector contains the parent selector, &, outside interpolation.
  • If @at-root is nested within a @keyframes block.

Options

true

The following patterns are considered warnings:

@at-root .a { margin: 3px; }
.a { @at-root .b & { margin: 3px; } }
@keyframes slidein {
  @at-root from {
    transform: translateX(0%);
  }

  to {
    transform: translateX(100%);
  }
}

The following patterns are not considered warnings:

.a { @at-root .b { margin: 3px; } }
.a { @at-root .b#{&} { margin: 3px; } }
.a {
  @at-root .b {
    @keyframes slidein {
      from {
        transform: translateX(0%);
      }
    
      to {
        transform: translateX(100%);
      }
    }
  }
}