Registry / testing / bemlinter

bemlinter

JSON →
library2.0.0-beta.8jsnpmunverified

A CLI tool to lint BEM component isolation in CSS/SCSS files, currently at version 2.0.0-beta.8. It enforces two main rules: a CSS block file should only contain its own classes, and a CSS file should not style classes from another block. This helps maintain modularity in large-scale CSS projects. The tool supports configuration via JSON files, including options for sources, exclusions, snapshots, lower-case checks, class prefixes, file patterns, and module overrides. It requires Node.js >=6 and is published under the MIT license. Compared to other linters, bemlinter focuses specifically on BEM methodology and isolation, rather than general CSS quality or formatting.

npm install bemlinter
INSTALL
IMPORT
SIG · BEMLINTER
B
bemlinter
testingjavascriptv2.0.0-beta.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const bemlinter = require('bemlinter')
import bemlinter from 'bemlinter'
Package is CommonJS only; ESM import will not work.
lint
const { lint } = require('bemlinter')
Named export for the lint function.
Cli
const Cli = require('bemlinter').Cli
import { Cli } from 'bemlinter'
Cli class for programmatic use; ESM import also fails.

Shows programmatic usage of the lint function with configuration options.

const { lint } = require('bemlinter'); const result = lint('src/**/*.scss', { excludeBlock: ['old-block'], checkLowerCase: true }); console.log('Errors:', result.errors); console.log('Warnings:', result.warnings);
bemlinter --version
Debug
Known issues
deprecatedPackage is in beta (2.0.0-beta.8). API may change before stable release.
fix
Pin to exact version and monitor for stable releases.
affects: 2.0.0-beta.x
gotchaThe CLI command requires a path argument; missing it will cause a confusing error.
fix
Always provide a path like 'bemlinter lint *.scss'.
affects: *
gotchaThe 'snapshot' option is experimental; enabling it may produce unexpected behaviors.
fix
Only enable snapshot if you understand its purpose and have read the docs.
affects: *
breakingVersion 2.0.0-beta.x introduced a new configuration file structure that is incompatible with version 1.x.
fix
Migrate your bemlinter.json to the new format; see migration guide in docs.
affects: >=2.0.0-beta.0
Errors
Common errors & fixes
Error: Cannot find module 'bemlinter'
Missing installation or global install without local install.
fix
Run 'npm install bemlinter --save-dev' in your project.
SyntaxError: Unexpected token import
Using ESM import syntax with a CommonJS package.
fix
Replace 'import bemlinter from "bemlinter"' with 'const bemlinter = require("bemlinter")'.
bemlinter: lint: no such file or directory
The provided path does not match any files.
fix
Verify the glob pattern or path; e.g., 'bemlinter lint src/**/*.scss'.
Upgrade
Version history
2.0.0-beta.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
bemlinter — npm install bemlinter · libregistry