Support for linting BEM selectors without component definition?
See original GitHub issueBackground: I have an existing project using scss-lint which I’m migrating to stylelint for faster performance. One of the things I want to lint is selector format in which I’m following the Harry Roberts convention (originally described here)
The Ask:
The way that postcss-bem-linter
is written, it requires a “component definition” in order for the linter to check anything. My concern is that this represents an opt-in scenario for developers. If they never setup a component definition then their selectors will never be linted.
Using postcss-bem-linter
, is it possible to just check that all selectors conform to the general pattern for naming (block__element--modifier
) according to the convention above but without a component definition?
The Followup:
Where does this concept of a “component definition” come from? I haven’t been able to find any documentation on its use with BEM apart from the postcss-bem-linter
README.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
@davidtheclark Thanks for the quick response. I think that your suggestion is a good one - I overlooked
selector-class-pattern
when I found your stylelint-selector-bem-pattern.I added a rule:
It’s petty gnarly but it works.
For now though I’m going to shelve the migration to stylelint as it isn’t as feature-rich as scss-lint. The main things I’ve come across that I’m missing are:
I’ll see about adding plugins to stylelint for the above features as I have time.
@bookwyrm Is it for Harry potter’s BEM style?