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

Exclude code inside different mixin and media in no-mergeable-selectors #599

Closed
ncoden opened this issue Apr 7, 2016 · 4 comments
Closed

Comments

@ncoden
Copy link
Contributor

ncoden commented Apr 7, 2016

Hi,

The following code throw a no-mergeable-selectors warning:

// - Mobile -
.col-menu { ... // 12-size column }
.col-content { ... // 12-size column }

// - Tablet and large screen -
@include breakpoint(medium) { // media block in foundation
  .col-menu { ... // 3-size column }
  .col-content { ... // 9-size column }
}

// - or -
@media screen and (min-width: 40em) { // same thing
...
}

I think no-mergeable-selectors shouldn't consider that these blocks are mergeable. @include breakpoint(...) can be repeated inside each class declaration, but it's more difficult to read, maintain, and sometimes it can't be possible.

no-mergeable-selectors should have the following behaviors:

.foo { ... }

// In a scope, no error
@include bar {
  .foo { ... }
}
@media (min-width: 40em) {
  .foo { ... )
}

// In different scopes, no error
@include baz             { .foo { ... } } // different mixin
@include bar(qux)        { .foo { ... } } // same mixin, with an argument
@include bar(quux)       { .foo { ... } } // same mixin, different argument
@media (min-width: 20em) { .foo { ... } } // different media argument

// But if the selector have already been declared for this scope, so it is mergeable
.foo { ... } // Error
@include bar             { .foo { ... } } // Error
@media (min-width: 40em) { .foo { ... } } // Error

What do you think ?

@DanPurdy
Copy link
Member

DanPurdy commented Apr 7, 2016

I think we may already have you covered here, I recently updated the rule but unfortunately the update hasn't come out yet due to some windows issues with the AST we're using.

In the meantime you can look twoards the bottom of the latest no-mergeable-selectors test file to see the extra cases I've got it checking against/ignoring now. I'll have a closer look tomorrow though and make sure.

@ncoden
Copy link
Contributor Author

ncoden commented Apr 7, 2016

👍 Thanks. Do you know when the update will come ?

@BPScott
Copy link

BPScott commented Apr 7, 2016

Duplicate of #307.

@DanPurdy
Copy link
Member

DanPurdy commented Apr 7, 2016

@ncoden we need to decide the best course of action with the windows problems for now and whether we just release anyway with a notice for affected users to stay on 1.5.1 but hopefully that wont be too long, we're just all incredibly busy again 😭

@DanPurdy DanPurdy closed this as completed Apr 7, 2016
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

3 participants