gulp-bemlinter
raw JSON → 2.0.0-beta.3 verified Fri May 01 auth: no javascript
A Gulp plugin to lint BEM component isolation in CSS/SCSS files. Version 2.0.0-beta.3, moderate release cadence. Wraps the base bemlinter package. Differentiators: specifically targets BEM methodology violations in SCSS files, integrates with Gulp task runners.
Common errors
error TypeError: bemlinter(...).pipe is not a function ↓
cause Calling bemlinter() without require correctly
fix
Ensure proper require: const bemlinter = require('gulp-bemlinter');
error Error: Cannot find module 'bemlinter' ↓
cause Missing dependency bemlinter
fix
Run: npm install bemlinter
Warnings
deprecated gulp-bemlinter is a wrapper around the deprecated bemlinter package ↓
fix Consider migrating to a maintained linter like stylelint
breaking Breaking changes: 2.0.0-beta versions may have unstable API ↓
fix Pin to exact version or use 1.x
gotcha Requires SCSS files; CSS-only files may not be analyzed correctly ↓
fix Ensure file extensions are .scss
Install
npm install gulp-bemlinter yarn add gulp-bemlinter pnpm add gulp-bemlinter Imports
- gulp-bemlinter plugin (default import) wrong
import bemlinter from 'gulp-bemlinter';correctconst bemlinter = require('gulp-bemlinter'); - bemlinter() wrong
.pipe(bemlinter.init())correct.pipe(bemlinter()) - bemlinter.format() wrong
.pipe(bemlinter.formatter())correct.pipe(bemlinter.format()) - bemlinter.failOnError() wrong
.pipe(bemlinter.failOnError)correct.pipe(bemlinter.failOnError())
Quickstart
const gulp = require('gulp');
const bemlinter = require('gulp-bemlinter');
gulp.task('lint', () => {
return gulp.src('styles/**/*.scss')
.pipe(bemlinter())
.pipe(bemlinter.format())
.pipe(bemlinter.failOnError());
});
gulp.task('default', gulp.series('lint'));