bemlinter
bemlinter copied to clipboard
Should we compile the scss?
Because we do not compile the SCSS files, we can not detect BEM errors like this one:
.block__element {
&__antoher-element {}
}
Another example is a selector created by a mixin.
For now, we choose to throw an error when the & operator is used to concatenate class name #4
It's maybe possible to keep source line number reference with a trick. Do you know how babel keep the reference to the source when it transforms js code on the fly ?
Can we base ourselves on generated sourcemaps to detect those kind of things ? But a temporary solution would be to add a warning when we fall to case like this &__
. Some people may prefer to code like this.
Thanks @malikba, you could be right! It's became a bad practice to use Sass concatenation for CSS class names. It prevents simple search and complexify the sources.
We seem to use 22 times for now in our project in only 4 files. A warning is the simplest solution and also a way to push for best practices :+1:
Maybe we could also compile the scss, but later, in v2, or v3 :tongue: