{"id":25697,"library":"gulp-lesshint","title":"gulp-lesshint","description":"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.","status":"active","version":"6.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/lesshint/gulp-lesshint","tags":["javascript","gulp","gulpplugin","less","lesshint","lint","linter"],"install":[{"cmd":"npm install gulp-lesshint","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-lesshint","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-lesshint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core linting engine; must be installed separately or automatically as peer dependency","package":"lesshint","optional":true}],"imports":[{"note":"CommonJS module; does not support ESM import syntax - use require()","wrong":"import lesshint from 'gulp-lesshint';","symbol":"lesshint","correct":"const lesshint = require('gulp-lesshint');"},{"note":"reporter is a method on the lesshint function, not a standalone export","wrong":"gulp.src('*.less').pipe(lesshint.reporter('reporter-name'))","symbol":"lesshint.reporter","correct":"gulp.src('*.less').pipe(lesshint()).pipe(lesshint.reporter('reporter-name'))"},{"note":"Must be used as a pipe step after lesshint()","wrong":"lesshint.failOnError()","symbol":"lesshint.failOnError","correct":"const lesshint = require('gulp-lesshint'); ... .pipe(lesshint.failOnError())"}],"quickstart":{"code":"const gulp = require('gulp');\nconst lesshint = require('gulp-lesshint');\n\nexports.lint = () => {\n    return gulp.src('./src/*.less')\n        .pipe(lesshint({\n            configPath: './.lesshintrc',\n            maxWarnings: 10\n        }))\n        .pipe(lesshint.reporter('lesshint-reporter-stylish'))\n        .pipe(lesshint.failOnError());\n};","lang":"javascript","description":"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."},"warnings":[{"fix":"Use failOnError() for error-only failures, or implement custom logic to check warnings count vs maxWarnings after pipe.","message":"failOnWarning() does not respect maxWarnings option; it fails on any warning regardless of count.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Rename config file to .lesshintrc or specify configPath option.","message":"Use of .lesshintrc.json filename deprecated in favor of .lesshintrc (no extension) in newer lesshint versions.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Ensure lesshint() is piped before reading file.lesshint.","message":"lesshint property on file object is undefined if lesshint() pipe is not used before accessing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update lesshint to version ^3.x; check for breaking rule changes.","message":"lesshint peer dependency changed from lesshint@^2 to lesshint@^3 in version 4.0.0; may cause incompatibility.","severity":"breaking","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install lesshint --save-dev","cause":"lesshint not installed or not in node_modules","error":"Error: Cannot find module 'lesshint'"},{"fix":"Ensure you require('gulp-lesshint') and call lesshint() first: const lesshint = require('gulp-lesshint'); ... .pipe(lesshint()).pipe(lesshint.reporter('stylish'))","cause":"Using lesshint.reporter before calling lesshint() or importing incorrectly","error":"TypeError: lesshint.reporter is not a function"},{"fix":"Create a .lesshintrc file in project root or specify configPath option with absolute path.","cause":"lesshint expects a configuration file but none exists in the project root","error":"Error: Config file not found: .lesshintrc"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}