postcss / postcss-bem-linter

A BEM linter for postcss
MIT License
572 stars 35 forks source link

Utility selectors for SUIT preset #98

Closed ismamz closed 7 years ago

ismamz commented 7 years ago

Hi, A utility name should be u-[sm-|md-|lg-]<utilityName> according to SUIT naming convention. However the SUIT preset pattern don't consider errors the following:

.u-UtilityName
.u-utility-name
.u-sm-utility-name

The next pattern fix this:

utilitySelectors: /^\.u-(sm-|md-|lg-)?(?:[a-z0-9][a-zA-Z0-9]*)+$/
.u-utilityName     /* pass */
.u-sm-utilityName  /* pass */
.u-md-utilityName  /* pass */
.u-lg-utilityName  /* pass */
.u-UtilityName     /* error */
.u-utility-name    /* error */
.u-sm-utility-name /* error */

Don't you think that this should be part of the SUIT preset?

Let me know if I missing something or I can send a pull request.

simonsmith commented 7 years ago

Hi @ismamz

I'd agree that the linter should be failing the selectors you listed above. It would be excellent if you could open a PR with some relevant tests. Let me know if I can help.