lesshint
lesshint
is a tool to aid you in writing clean and consistent Less.
Installation
Node.js 4 (or later) is required.
Run the following from the command line to install lesshint
(add -g
to install globally):
npm install lesshint
Configuration
For information on how to configure lesshint
and other available options, see the user guide.
Since lesshint
is highly customizable we recommend you to also take a look at the available rule options to tailor it to your needs.
CLI usage
Run lesshint
from the command-line by passing one or more files/directories to recursively scan.
lesshint src/less/ lib/style.less
Available Flags | Description |
---|
-c /--config | Specify the configuration file to use (will be merged with defaults). |
-e /--exclude | A minimatch glob pattern or a file to exclude from being linted. |
-l /--linters | Paths to custom linters to add to the built-in list. See "Linters" below for more information. |
-r /--reporter | The reporter to use. See "Reporters" below for more information. |
-V /--version | Show the version. |
-x /--max-warnings | Number of warnings to allow before exiting with a non-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 |
---|
0 | Everything is alright, no linting errors found. |
1 | One or more linting errors with a severity of warning was found. |
2 | One or more linting errors with a severity of error was found. |
66 | No files to lint were supplied. |
70 | An unknown error occurred within lesshint , possibly a bug. Please file an issue! |
78 | Something is wrong with the config file, most likely invalid JSON. |
These codes were chosen with regards to the preferable exit codes.
Complementary tools
Linters
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
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.
Developer resources