Registry / testing / grunt-lesslint

grunt-lesslint

JSON →
library5.0.0jsnpmunverified

Grunt task that compiles LESS files and runs CSS Lint on the generated CSS, mapping errors back to the original LESS lines. Version 5.0.0 is the current stable release; the project is in maintenance mode with infrequent updates. Key differentiators: integrates CSS Lint rules with LESS source mapping for line-accurate error reporting, supports failOnWarning/failOnError options for staged rule adoption, and allows configuration of LESS parser options. Alternative tools (e.g., stylelint, lesshint) are more actively maintained.

npm install grunt-lesslint
INSTALL
IMPORT
SIG · GRUNT-LESSLINT
G
grunt-lesslint
testingjavascriptv5.0.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.

grunt-lesslint
grunt.loadNpmTasks('grunt-lesslint')
require('grunt-lesslint')
Grunt plugins are registered via grunt.loadNpmTasks in the Gruntfile, not via require().
lesslint (task)
grunt.initConfig({ lesslint: { src: ['src/**/*.less'] } })
grunt.initConfig({ 'grunt-lesslint': { ... } })
Task name is 'lesslint', not the package name.
options (csslint, less, imports)
lesslint: { options: { csslint: { 'known-properties': false }, less: { paths: ['includes'] }, imports: false } }
lesslint: { options: { csslint: { 'known-properties': false, paths: ['includes'] } } }
CSS Lint options go under 'csslint', LESS parser options under 'less', and import linting under 'imports'.

Example Gruntfile configuration to lint LESS files with custom CSS Lint rules, LESS include paths, import linting disabled, and warnings not failing the build.

// Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ lesslint: { src: ['src/**/*.less'], options: { csslint: { 'known-properties': false, csslintrc: '.csslintrc' }, less: { paths: ['includes'] }, imports: false, failOnWarning: false } } }); grunt.loadNpmTasks('grunt-lesslint'); grunt.registerTask('default', ['lesslint']); };
Debug
Known issues
deprecatedCSS Lint is no longer actively maintained; consider switching to stylelint or lesshint.
fix
Migrate to a more modern linter like stylelint with less syntax support.
affects: all
gotchaBy default, imported files are not linted. Must set `options.imports: true` to lint imports.
fix
Add `imports: true` to lesslint options.
affects: all
gotchaSetting `failOnError: false` overrides both warnings and errors; task never fails.
fix
Use `failOnWarning: false` if you only want to allow warnings without failing.
affects: >=5.0.0
breakingVersion 5.0.0 changed the summary output format and introduced `failOnWarning` option. Old summary format (e.g., '58 lint issues in 167 files (0 errors, 58 warnings)') is now used instead of previous format.
fix
Update any scripts parsing task output to expect the new format.
affects: >=5.0.0
Errors
Common errors & fixes
Warning: Task "lesslint" failed. Use --force to continue.
Lint errors or warnings are present and failOnWarning defaults to true.
fix
Set `failOnWarning: false` to allow warnings without failure, or fix the lint issues.
Cannot find module 'grunt-lesslint'
Package not installed or not properly loaded.
fix
Run `npm install grunt-lesslint --save-dev` and ensure `grunt.loadNpmTasks('grunt-lesslint')` is in Gruntfile.
Fatal error: Unable to find a valid version for CSS Lint.
Missing peer dependency csslint or incompatible version installed.
fix
Install csslint: `npm install csslint --save-dev`.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency; requires Grunt >=0.4.5 to load and run tasks.
Agent activity
4 hits · last 30 days
node
4
Resources
grunt-lesslint — npm install grunt-lesslint · libregistry