autolesshint v0.2.2
autolesshint
autolesshint is a tool to automatically fix Lesshint >=v4.0.0 complaints.
Installation
Run the following command from the command line (add -g to install globally):
npm install autolesshintCLI usage
Run autolesshint from the command-line by passing one or more files/directories to recursively scan.
autolesshint 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. |
-V/--version | Show version. |
Supported rules
attribute_quotesborder_zerocommentempty_rulefinal_newlinehex_lengthhex_notationnewline_after_blocksingle_line_per_selectorspace_before_bracespace_between_parensstring_quotestrailing_semicolontrailing_whitespaceurl_quoteszero_unit
See the Complete rule coverage milestone for upcoming coverage support.
Unsupported rules
These rules contain logic that require user input and can't be automatically fixed:
depth_levelduplicate_propertyhex_validationid_selectorimport_pathimportant_rulemax_char_per_lineproperty_unitsqualifying_elementselector_namingurl_format
Contributing
autolesshint uses Gulp to automate building, which requires Node.js.
To build from scratch, install NodeJS and run the following commands:
npm install -g gulp
npm install
gulpautomutate manages the runtime of taking in lint complaints from lesshint.
These are mapped to Suggester classes in src/suggesters by name.
automutate-tests manages development-time tests verifying actual file mutations.
Adding a suggester
- Add a
Suggesterclass with a linter's name.my_rulewould be mapped tosrc/suggesters/myRuleSuggester.tsthat would have to export aMyRuleSuggesterclass that implements theISuggesterinterface. - Add test case(s) under
test/casesthat each have anoriginal.less,expected.less,actual.less, and.lesshintrc. - Add the suggester to the list in
README.md. - Submit a PR referencing the issue corresponding to the lint rule.