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

Stylelint: Consider ignoring @media when parsing max-nesting rule #105

Open
mikeselander opened this issue Nov 14, 2018 · 2 comments
Open

Comments

@mikeselander
Copy link
Contributor

Currently, we have a max-nesting rule that is very strict at only allowing 2 levels of nesting with scss, with the exception of blockless-at-rules. I think it might be beneficial to loosen this just a bit for @media rules by adding "ignoreAtRules": ["media"] to the general rule in Stylelint.

Stylelint currently already ignores @media at the first level in a nesting pattern when parsing for nesting depth, but it does not ignore @media when it resides down the chain. If we make the proposed change, @media levels will not affect the nesting depth evaluation, and we still shouldn't end up with too-specific of selectors.

Thoughts?

cc @peterwilsoncc @sambulance @goldenapples @rmccue @joemcgill @kirstyburgoine

@peterwilsoncc
Copy link
Contributor

Is it possible to ignore @media when calculating the depth while including items within it?

I don't want to allow:

body {
  @media ( min-width: 1em ) {
    .nesting {
      .all {
        .the {
          .way {
             down: 🙁;
          }
        }
      }
    }
  }
}

@mikeselander
Copy link
Contributor Author

Hhhmmm that might be a problem, yes. I mis-read that rule originally but testing it more it does seem to ignore anything under the media query and not just the level the media query is at.

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

No branches or pull requests

2 participants