# stylelint-less

> A collection of Less specific rules for stylelint

Latest version **4.2.1** (published 2026-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install stylelint-less
pnpm add stylelint-less
yarn add stylelint-less
bun add stylelint-less
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.2.1 |
| Published | 2026-04-18 |
| First published | 2021-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 26.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 13 |
| Author | Sivantarajan |
| Maintainers | ubermanu, sivanatarajan |
| Keywords | stylelint, stylelint-plugin, css, less |

## Links

- npm: https://www.npmjs.com/package/stylelint-less
- Repository: https://github.com/stylelint-less/stylelint-less
- Homepage: https://github.com/stylelint-less/stylelint-less#readme
- Issues: https://github.com/stylelint-less/stylelint-less/issues
- npm.io page: https://npm.io/package/stylelint-less

## Dependencies (3)

- [css-tree](https://npm.io/package/css-tree.md) ^3.2.1
- [@types/css-tree](https://npm.io/package/@types/css-tree.md) ^2.3.11
- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) 4.2.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 4.2.1 (latest) — 2026-04-18
- 4.2.0 — 2026-04-18
- 4.1.0 — 2026-03-23
- 4.0.0 — 2026-01-02
- 3.0.1 — 2023-12-17
- 3.0.0 — 2023-12-13
- 2.0.0 — 2023-09-04
- 1.0.8 — 2023-07-13
- 1.0.7 — 2023-06-29
- 1.0.6 — 2022-06-18
- 1.0.5 — 2022-03-09
- 1.0.4 — 2022-03-09
- 1.0.3 — 2022-02-09
- 1.0.2 — 2022-02-08
- 1.0.1 — 2021-07-02
- … 1 more at https://npm.io/package/stylelint-less/versions

## README

# stylelint-less

A collection of [Less](https://lesscss.org/) specific rules for [stylelint](https://github.com/stylelint/stylelint).

## Installation

```shell
npm install stylelint-less --save-dev
```

## Usage

Add the `stylelint-less` plugin to your configuration, and set the rules you want to use under the `less` namespace.

```json
{
  "plugins": ["stylelint-less"],
  "rules": {
    "at-rule-no-unknown": null,
    "color-no-invalid-hex": true,
    "less/color-no-invalid-hex": true
  }
}
```

Please refer to the [stylelint](https://stylelint.io/user-guide/get-started/) docs for additional information on how to create a configuration file or add rules.

## Rules

- [less/color-hex-case](src/rules/color-hex-case): Specify lowercase or uppercase for hex colors.
- [less/color-no-hex](src/rules/color-no-hex): Disallow hex colors.
- [less/color-no-invalid-hex](src/rules/color-no-invalid-hex): Disallow invalid hex colors.
- [less/no-duplicate-variables](src/rules/no-duplicate-variables): Disallow duplicate variables within a scope.

## Note

Please make sure there is

- No space between variable and ':'
- A space between ":" and value
  example
  `@color: red;`

so that these rules will work as expected. If the variable is not in the above format , you will
get `Invalid variable` error.

---
_Source: https://npm.io/package/stylelint-less · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
