Registry / testing / xl-gulp-lesshint

xl-gulp-lesshint

JSON →
library4.1.3jsnpmunverified

Gulp plugin for linting .less files using lesshint. Current stable version is 4.1.3. It runs the lesshint linter on source files and provides reporter and failOnError functionality for Gulp pipelines. Key differentiators: integrates smoothly with Gulp, supports custom config path, maxWarnings, and multiple reporters. Compared to other Less linters (e.g., stylelint with less syntax), it is dedicated to Less and uses lesshint's own rules.

npm install xl-gulp-lesshint
INSTALL
IMPORT
SIG · XL-GULP-LESSHINT
X
xl-gulp-lesshint
testingjavascriptv4.1.3
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 (lesshint function)
const lesshint = require('gulp-lesshint');
import lesshint from 'gulp-lesshint'; // This package does not export a default ESM export.
CommonJS module; use require in Node.js environments. ESM named import is not supported.
lesshint.reporter
.pipe(lesshint.reporter('stylish'))
.pipe(lesshint.reporter()) // Works, but uses default stylish. Accepts string or function.
Reporter can be a string (name of npm package) or a custom reporter function.
lesshint.failOnError
.pipe(lesshint.failOnError())
none
Call as a function: failOnError(). No arguments.

This example shows how to set up a Gulp task that lints all .less files in the src directory using a custom config file, reports errors with the stylish reporter, and fails the task on any error.

const gulp = require('gulp'); const lesshint = require('gulp-lesshint'); function lint() { return gulp.src('src/**/*.less') .pipe(lesshint({ configPath: '.lesshintrc' })) .pipe(lesshint.reporter('lesshint-reporter-stylish')) .pipe(lesshint.failOnError()); } exports.lint = lint;
Debug
Known issues
gotchaThis package is a Gulp plugin and requires Node.js and Gulp. It is not a standalone linter.
fix
Ensure Gulp is installed and Gulp tasks are properly defined.
affects: >=1.0.0
deprecatedlesshint.reporter() without arguments still uses default 'lesshint-reporter-stylish' but may be deprecated in future versions.
fix
Explicitly pass 'stylish' or a custom reporter name.
affects: >=4.0.0
breakingVersion 4.x drops support for Node.js <10.
fix
Upgrade Node.js to version 10 or higher.
affects: >=4.0.0 <5.0.0
breakinglesshint.failOnError() no longer accepts arguments since v4.
fix
Remove any arguments passed to failOnError() call.
affects: >=4.0.0
gotchalesshint must be installed separately as a peer dependency; it is not bundled.
fix
Run: npm install lesshint --save-dev
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'gulp-lesshint'
Package is not installed in node_modules.
fix
Run: npm install gulp-lesshint --save-dev
TypeError: lesshint.reporter is not a function
Module may be imported incorrectly (e.g., trying to use default import instead of require).
fix
Use: const lesshint = require('gulp-lesshint');
Error: No reporter found for '<reporter-name>'
The specified reporter name does not correspond to an installed package or invalid name.
fix
Install the reporter package: npm install lesshint-reporter-<name> --save-dev
TypeError: lesshint.failOnError is not a function
Using an older version of this plugin (<4.0.0) where failOnError may not exist.
fix
Update to the latest version: npm install gulp-lesshint@latest --save-dev
Error: lesshint is not a function
lesshint peer dependency not installed.
fix
Run: npm install lesshint --save-dev
Upgrade
Version history
4.1.3latest on npm
Audit
Dependencies
plugin-errorrequiredCore dependency for creating Gulp plugin errors
fancy-logrequiredUsed for logging messages in the Gulp stream
lesshintrequiredPeer dependency for linting Less files
Agent activity
21 hits · last 30 days
node
20
Resources
xl-gulp-lesshint — npm install xl-gulp-lesshint · libregistry