JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 129104
  • Score
    100M100P100Q180396F
  • License MIT

Package Exports

  • stylelint-selector-bem-pattern

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stylelint-selector-bem-pattern) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stylelint-selector-bem-pattern

A stylelint plugin that incorporates postcss-bem-linter.

To learn more about postcss-bem-linter, please read that module's documentation.

Installation

npm install stylelint-selector-bem-pattern

Be warned: v0.2.0+ is only compatible with stylelint v3+. For earlier version of stylelint, use earlier verisons of this.

Usage

Add it to your stylelint config plugins array, then add "selector-bem-pattern" to your rules, specifying the severity and your postcss-bem-linter settings as the primary option. Like so:

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

For more examples of postcss-bem-linter configuration possibilities, please read that module's documentation. Keep in mind that if your stylelint config is JSON you will have to use strings to specify your selector patterns (as above).