csstools / stylelint-use-nesting

Enforce nesting when it is possible in CSS
Creative Commons Zero v1.0 Universal
40 stars 8 forks source link

"Undefined" in violation message for at-rules #2

Closed jeddy3 closed 5 years ago

jeddy3 commented 5 years ago

Thanks for a great plugin! It's already caught inconsistencies in our code base since we started using it last week.

Since, 1.2.0 the plugin warns about unnested at-rules. However, the violation message isn't as helpful as the one that accompanies unnested rules.

.class {}

@media (min-width: 48rem) {
  .class {}
}

Produces:

1:1   ✖  Expected ".class" inside "undefined".   csstools/use-nesting

Whereas:

.class {}

.class:hover {}

Produces:

3:1   ✖  Expected ".class:hover" inside ".class".   csstools/use-nesting

Is it possible to improve the at-rule violation message so that the at-rule is mentioned by name e.g. Expected "@media" inside ".class"?

jonathantneal commented 5 years ago

Yes it is, @jeddy3. Thanks for bringing this to my attention. I can also improve my tests to cover the usability of its warning messages.

jonathantneal commented 5 years ago

Resolved by https://github.com/csstools/stylelint-use-nesting/commit/38588633b18307ec1bae3f9c0323830405c6739a

Published in v1.2.1! 🎉

jeddy3 commented 5 years ago

Published in v1.2.1! 🎉

Fantastic, thank you very much!