question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scss/selector-no-redundant-nesting-selector

See original GitHub issue

I just updated to version 2.1.0 and this became an issue:

.foo {
  &,
  & .bar {
    // some style
  }
}

[stylelint] Unnecessary nesting selector (&) (scss/selector-no-redundant-nesting-selector)

I think that this should be a valid use case.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
kristerkaricommented, Sep 9, 2017

@testerez This is actually not a bug. You are getting the error because of & that is infront of .bar.

So these codes are actually equal after you compile them with Sass:

Fails linting

.foo {
  &,
  & .bar {
    // some style
  }
}

Passes linting

.foo {
  &,
  .bar {
    // some style
  }
}

=

.foo,
.foo .bar {

}
0reactions
testerezcommented, Sep 9, 2017

Oh yes you’re right. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

selector-no-redundant-nesting-selector - stylelint-scss - GitHub
A collection of SCSS specific linting rules for Stylelint - stylelint-scss/README.md at master · stylelint-scss/stylelint-scss.
Read more >
selector-nested-pattern - Stylelint
Non-standard selectors (e.g. selectors with Sass or Less interpolation) and selectors of rules nested within at-rules are ignored. The message secondary option ...
Read more >
Should I always nest selectors in other selectors when using ...
My question is about nesting in sass or scss. It is a good thing from the readability perspective that we can nest selectors...
Read more >
stylelint-scss - npm
Start using stylelint-scss in your project by running `npm i stylelint-scss`. ... "scss/selector-no-redundant-nesting-selector": true,.
Read more >
Beware of Selector Nesting in Sass - SitePoint
Depending on the way it is used, it can yield a totally different CSS output. Here is a collection of simple examples. /*...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found