Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting depth warning on BEM structure #18

Closed
marcoturi opened this issue Sep 20, 2016 · 8 comments
Closed

Nesting depth warning on BEM structure #18

marcoturi opened this issue Sep 20, 2016 · 8 comments

Comments

@marcoturi
Copy link

marcoturi commented Sep 20, 2016

The above code will throw a warning (nesting should not be greater than 1) from sass lint:

.example {
  top: 43px;
  &__section { // <-- this line
    width: 100%;
  }
}
@KittyGiraudel
Copy link
Owner

Yep. It's expected. :)

@marcoturi
Copy link
Author

marcoturi commented Sep 20, 2016

But it's not a nesting selector. What you suggest for a project using BEM, to get rid of the warning correctly? Disable the sass lint rule ? Or use a mixin instead of & ? Thank you for your fast response :)

@KittyGiraudel
Copy link
Owner

It definitely is a nested selector. It might not generate a compound selector but it still generates a selector nevertheless. I’d recommend you don’t use selector nesting entirely, but that’s really up to you.

@marcoturi
Copy link
Author

marcoturi commented Sep 20, 2016

if I avoid the the syntax of the first post, following your advice to "....have the base name repeated. " (from here). For example:

.example {
 top: 43px;
}

.example__section { //<-- this line again
  width: 100%;
}

I get another warning from sass-lint about the regexp for the "__". Do I miss something ?

@KittyGiraudel
Copy link
Owner

Okay, that might be a bug then. :)
Are you using the configuration from this repo?

@KittyGiraudel
Copy link
Owner

Just updated the configuration for SelectorFormat, care to try it?

@marcoturi
Copy link
Author

No warnings now. Thank you!

@KittyGiraudel
Copy link
Owner

Lovely. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants