# stylelint-selector-bem-pattern

> A stylelint plugin that harnesses the power of postcss-bem-linter

Latest version **5.0.0** (published 2026-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install stylelint-selector-bem-pattern
pnpm add stylelint-selector-bem-pattern
yarn add stylelint-selector-bem-pattern
bun add stylelint-selector-bem-pattern
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-05-16 |
| First published | 2015-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=24.13.0 |
| Dependencies | 2 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 248 |
| Author | David Clark |
| Maintainers | davidtheclark, alecrust, simonsmith |
| Keywords | stylelint, stylelint-plugin, css, nesting, linter, bem |

## Links

- npm: https://www.npmjs.com/package/stylelint-selector-bem-pattern
- Repository: https://github.com/simonsmith/stylelint-selector-bem-pattern
- Homepage: https://github.com/simonsmith/stylelint-selector-bem-pattern#readme
- Issues: https://github.com/simonsmith/stylelint-selector-bem-pattern/issues
- npm.io page: https://npm.io/package/stylelint-selector-bem-pattern

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) ^8.5.6
- [postcss-bem-linter](https://npm.io/package/postcss-bem-linter.md) ^4.0.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-05-16
- 4.0.1 — 2024-09-09
- 4.0.0 — 2024-02-27
- 3.0.1 — 2023-08-12
- 3.0.0 — 2023-06-28
- 2.1.1 — 2021-07-24
- 2.1.0 — 2019-04-03
- 2.0.0 — 2017-09-07
- 1.1.1 — 2017-08-08
- 1.1.0 — 2017-06-23
- 1.0.0 — 2016-05-07
- 0.2.3 — 2016-03-17
- 0.2.2 — 2016-03-05
- 0.2.1 — 2016-01-22
- 0.2.0 — 2015-12-11
- … 4 more at https://npm.io/package/stylelint-selector-bem-pattern/versions

## README

# stylelint-selector-bem-pattern

[![NPM version](http://img.shields.io/npm/v/stylelint-selector-bem-pattern.svg)](https://www.npmjs.com/package/stylelint-selector-bem-pattern) [![Build Status](https://github.com/simonsmith/stylelint-selector-bem-pattern/actions/workflows/ci.yml/badge.svg)](https://github.com/simonsmith/stylelint-selector-bem-pattern/actions/workflows/ci.yml)

A [stylelint](https://github.com/stylelint/stylelint) plugin that incorporates [postcss-bem-linter](https://github.com/postcss/postcss-bem-linter).

To learn more about postcss-bem-linter, please read [that module's documentation](https://github.com/postcss/postcss-bem-linter).

## Installation

```
npm install stylelint-selector-bem-pattern
```

## Usage

Add it to your stylelint config `plugins` array, then add `"plugin/selector-bem-pattern"` to your rules,
specifying your postcss-bem-linter settings as the primary option.

Even though postcss-bem-linter has the default setting of `{ preset: 'suit' }`, this plugin has
no default setting: if you want to use the SUIT preset, you must pass `{ preset: 'suit' }`,
and the rule will not work if you do not pass a primary option object.

Like so:

```js
// .stylelintrc
{
  "plugins": [
    "stylelint-selector-bem-pattern"
  ],
  "rules": {
    // ...
    "plugin/selector-bem-pattern": {
      "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](https://github.com/postcss/postcss-bem-linter).
Keep in mind that if your stylelint config is JSON you will have to use strings to
specify your selector patterns (as above).

---
_Source: https://npm.io/package/stylelint-selector-bem-pattern · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
