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

Nested multiple definitions #143

Open
amk221 opened this issue Jun 3, 2019 · 2 comments
Open

Nested multiple definitions #143

amk221 opened this issue Jun 3, 2019 · 2 comments

Comments

@amk221
Copy link

amk221 commented Jun 3, 2019

I was expecting this to work (maybe unreasonably?)

// style1.scss
.Style1 {
  /** @define Foo */
  .Foo {}
  .Foo__a {}
  .Foo__b {}
  /** @end */

  /** @define Bar */
  .Bar {}
  .Bar__a {}
  .Bar__b {}
  /** @end */
}
// style2.scss
.Style2 {
  /** @define Foo */
  .Foo {}
  .Foo__a {}
  .Foo__b {}
  /** @end */

  /** @define Bar */
  .Bar {}
  .Bar__a {}
  .Bar__b {}
  /** @end */
}

If, however, you have a good reason for multiple definitions within a single file, you can do that.

I think this is an OK reason? :)
I assumed the definitions apply to what they wrap.

Essentially the components are namespaced, e.g

<div class="Foo">
  <div class="Foo__a"></div>
  <div class="Foo__b"></div>
</div>

...but the actual styles are only applied when a parent class is present:

<body class="Style1">
  <div class="Foo">
    <div class="Foo__a"></div>
    <div class="Foo__b"></div>
  </div>
</div>
@amk221
Copy link
Author

amk221 commented Jun 12, 2019

Hi 👋
Can I get some feedback on whether this is worth me investing time on a PR? I don't want to start if it's not likely to get in.
Cheers

@simonsmith
Copy link
Collaborator

Hey @amk221

I've not encountered this use case but I'd agree it would be nice for the linter to permit it. A PR would be very welcome and I'd be happy to consider it for merge

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