Registry / testing / gulp-lesshint

gulp-lesshint

JSON →
library6.1.0jsnpmunverified

Gulp plugin integrating lesshint, a linting tool for Less stylesheets. Version 6.1.0 (stable) is the latest release; development is active with periodic updates. Provides a stream-based pipeline for linting .less files with configurable rules, custom reporters, and fail-on-error/warning functionality. Alternatives include gulp-lesshint's direct integration vs standalone lesshint CLI, but this plugin offers seamless gulp integration without additional tooling.

npm install gulp-lesshint
INSTALL
IMPORT
SIG · GULP-LESSHINT
G
gulp-lesshint
testingjavascriptv6.1.0
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.

lesshint
const lesshint = require('gulp-lesshint');
import lesshint from 'gulp-lesshint';
CommonJS module; does not support ESM import syntax - use require()
lesshint.reporter
gulp.src('*.less').pipe(lesshint()).pipe(lesshint.reporter('reporter-name'))
gulp.src('*.less').pipe(lesshint.reporter('reporter-name'))
reporter is a method on the lesshint function, not a standalone export
lesshint.failOnError
const lesshint = require('gulp-lesshint'); ... .pipe(lesshint.failOnError())
lesshint.failOnError()
Must be used as a pipe step after lesshint()

Defines a Gulp task that lints all .less files in src/, using a custom config, limiting warnings to 10, reporting with stylish reporter, and failing on errors.

const gulp = require('gulp'); const lesshint = require('gulp-lesshint'); exports.lint = () => { return gulp.src('./src/*.less') .pipe(lesshint({ configPath: './.lesshintrc', maxWarnings: 10 })) .pipe(lesshint.reporter('lesshint-reporter-stylish')) .pipe(lesshint.failOnError()); };
Debug
Known issues
gotchafailOnWarning() does not respect maxWarnings option; it fails on any warning regardless of count.
fix
Use failOnError() for error-only failures, or implement custom logic to check warnings count vs maxWarnings after pipe.
affects: >=1.0.0
deprecatedUse of .lesshintrc.json filename deprecated in favor of .lesshintrc (no extension) in newer lesshint versions.
fix
Rename config file to .lesshintrc or specify configPath option.
affects: >=4.0.0
gotchalesshint property on file object is undefined if lesshint() pipe is not used before accessing.
fix
Ensure lesshint() is piped before reading file.lesshint.
affects: >=1.0.0
breakinglesshint peer dependency changed from lesshint@^2 to lesshint@^3 in version 4.0.0; may cause incompatibility.
fix
Update lesshint to version ^3.x; check for breaking rule changes.
affects: >=4.0.0
Errors
Common errors & fixes
Error: Cannot find module 'lesshint'
lesshint not installed or not in node_modules
fix
npm install lesshint --save-dev
TypeError: lesshint.reporter is not a function
Using lesshint.reporter before calling lesshint() or importing incorrectly
fix
Ensure you require('gulp-lesshint') and call lesshint() first: const lesshint = require('gulp-lesshint'); ... .pipe(lesshint()).pipe(lesshint.reporter('stylish'))
Error: Config file not found: .lesshintrc
lesshint expects a configuration file but none exists in the project root
fix
Create a .lesshintrc file in project root or specify configPath option with absolute path.
Upgrade
Version history
6.1.0latest on npm
Audit
Dependencies
lesshintoptionalCore linting engine; must be installed separately or automatically as peer dependency
Agent activity
4 hits · last 30 days
node
4
Resources
gulp-lesshint — npm install gulp-lesshint · libregistry