simonsmith / stylelint-selector-bem-pattern

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

Cannot get Warnings #35

Closed johntimothybailey closed 7 months ago

johntimothybailey commented 6 years ago

I am using Stylelint v9 and cannot get warnings reported when using this plugin

CLI stylelint src/css/mason.css

.stylintrc.json

"plugins": [
    "stylelint-selector-bem-pattern"
  ],
  "rules": {
    "plugin/selector-bem-pattern": {
      "componentName": "pleasewarnings",
      "componentSelectors": {
        "initial": "^\\.{componentName}(?:-[a-z]+)?$",
        "combined": "^\\.combined-{componentName}-[a-z]+$"
      },
      "utilitySelectors": "^\\.util-[a-z]+$"
    }
  }

src/css/mason.css

.mason-card {
 color: #000;
}

To me this should cause the CLI to exit with errors. However, that is not the case and it exists 0 (i.e. successfully)

saulhardman commented 6 years ago

Hi John, you're required to add // @define mason (or /** @define mason */) to the top of the mason.css file in order to instruct the plugin what the name of the component is. It does not infer the name from the filename etc.

Edit: you can also use the implicit* options.