simonsmith / stylelint-selector-bem-pattern

Stylelint plugin that incorporates postcss-bem-linter
MIT License
244 stars 13 forks source link

Selector should be written in lowercase with hyphens (selector-class-pattern) #36

Closed Andrew-Dyachenko closed 6 months ago

Andrew-Dyachenko commented 5 years ago

Hi there!

This plugin was connected successfully, but the BEM rule does not work - the text editor continues to swear at the BEM stylistics. I'm using native VSCode stylelint plugin for linting styles

.stylelintrc.yml

img-2018-09-24-17-07-56

VSCode text editor marked problems img-2018-09-24-16-54-26

marked problem in styles

img-2018-09-24-17-04-32

Any ideas how to solve it?

jeddy3 commented 5 years ago

Somewhere in your stylelint configuration object you're turning on the built-in selector-class-pattern rule. You probably don't want to use that rule if you're using this plugin.

You can turn off that rule with:

rules:
  selector-class-pattern: null
Andrew-Dyachenko commented 5 years ago

Yes, that is right! I connected this rule selector-class-pattern: null and the error went away.

img-2018-09-24-17-20-43

Now no errors in VSCode

img-2018-09-24-17-25-56

I expect that this rule was included by extending via extends: stylelint-config-sass-guidelines by default...

dalberola commented 4 years ago

There is an alternative instead of disable the rule :

"selector-class-pattern": [ "^(?:(?:o|c|u|t|s|is|has|_|js|qa)-)?[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)(?:__[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+))?(?:--[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*)?(?:\[.+\])?$", { "message": "Class names should match the SUIT CSS naming convention" } ],

ref : https://github.com/btd1337/stylelint-config-sass-guidelines/blob/master/.stylelintrc