lesshint is a tool to aid you in writing clean and consistent Less.
- CLI usage
- Complementary tools
- Developer resources
Node.js 6 (or later) is required.
Run the following from the command line to install
-g to install globally):
npm install lesshint
For information on how to configure
lesshint and other available options, see the user guide.
lesshint is highly customizable we recommend you to also take a look at the available rule options to tailor it to your needs.
lesshint from the command-line by passing one or more files/directories to recursively scan. Quote the glob patterns for optimal cross-platform results.
lesshint "src/less/" "lib/style.less"
||Specify the configuration file to use (will be merged with defaults).|
||A globby glob pattern or a file to exclude from being linted.|
||Paths to custom linters to add to the built-in list. See "Linters" below for more information.|
||The reporter to use. See "Reporters" below for more information.|
||Show the version.|
||Number of warnings to allow before exiting with a non-zero code. Omit it to always exit with zero code.|
Exit status codes
Depending on the linter results and options supplied, the exit status code returned by the CLI will differ.
|Exit status code||Description|
||Everything is alright or only linting errors with a severity of
||One or more linting errors with a severity of
||No files to lint were supplied.|
||An unknown error occurred within
||Something is wrong with the config file, most likely invalid JSON.|
These codes were chosen with regards to the preferable exit codes.
- AtomLinter plugin - A Linter plugin for Atom.
- autolesshint - Automagically fix errors reported by
- Gulp plugin - A gulp plugin for
- Grunt plugin - A Grunt plugin for
- vscode-lesshint - A VS Code extension for
In addition to the linters included with
lesshint, it's also possible to include custom ones. For example to check something team or project specific.
For more information on using custom linters, see the user guide.
Reporters are small modules that can be used to perform actions with the lint results, for example printing something to the terminal or generate custom reports.
For more information on using reporters, see the user guide.