https://github.com/automutate/autolesshint
Automatically fixes Lesshint complaints.
https://github.com/automutate/autolesshint
less lesshint linter
Last synced: 10 months ago
JSON representation
Automatically fixes Lesshint complaints.
- Host: GitHub
- URL: https://github.com/automutate/autolesshint
- Owner: automutate
- License: mit
- Created: 2016-11-14T21:08:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-03T07:40:28.000Z (about 6 years ago)
- Last Synced: 2025-08-09T01:51:48.533Z (10 months ago)
- Topics: less, lesshint, linter
- Language: TypeScript
- Homepage:
- Size: 461 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# autolesshint
[](https://greenkeeper.io/)
[](https://www.npmjs.com/package/autolesshint)
`autolesshint` is a tool to automatically fix [Lesshint](https://github.com/lesshint/lesshint) >=v4.0.0 complaints.
* [Installation](#installation)
* [CLI usage](#cli-usage)
* [Supported rules](#supported-rules)
* [Contributing](#contributing)
## Installation
Run the following command from the command line (add `-g` to install globally):
```
npm install autolesshint
```
## CLI 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](https://github.com/isaacs/minimatch) or a file to exclude from being linted.
`-V`/`--version` | Show version.
## Supported rules
* `attribute_quotes`
* `border_zero`
* `comment`
* `empty_rule`
* `final_newline`
* `hex_length`
* `hex_notation`
* `newline_after_block`
* `single_line_per_selector`
* `space_before_brace`
* `space_between_parens`
* `string_quotes`
* `trailing_semicolon`
* `trailing_whitespace`
* `url_quotes`
* `zero_unit`
See the [Complete rule coverage](https://github.com/automutate/autolesshint/milestone/1) milestone for upcoming coverage support.
## Unsupported rules
These rules contain logic that require user input and can't be automatically fixed:
* `depth_level`
* `duplicate_property`
* `hex_validation`
* `id_selector`
* `import_path`
* `important_rule`
* `max_char_per_line`
* `property_units`
* `qualifying_element`
* `selector_naming`
* `url_format`
## Contributing
`autolesshint` uses [Gulp](http://gulpjs.com/) to automate building, which requires [Node.js](http://node.js.org).
To build from scratch, install NodeJS and run the following commands:
```
npm install -g gulp
npm install
gulp
```
[automutate](https://github.com/automutate/automutate) manages the runtime of taking in lint complaints from `lesshint`.
These are mapped to `Suggester` classes in `src/suggesters` by name.
[automutate-tests](https://github.com/automutate/automutate-tests) manages development-time tests verifying actual file mutations.
### Adding a suggester
* Add a `Suggester` class with a linter's name. `my_rule` would be mapped to `src/suggesters/myRuleSuggester.ts` that would have to export a `MyRuleSuggester` class that implements the `ISuggester` interface.
* Add test case(s) under `test/cases` that each have an `original.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.