# stylelint-order

> A collection of order related linting rules for Stylelint.

Latest version **8.1.1** (published 2026-03-15) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 8.1.1 |
| Published | 2026-03-15 |
| First published | 2016-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 |
| Dependencies | 2 |
| Unpacked size | 89.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 959 |
| Author | Aleks Hudochenkov |
| Maintainers | hudochenkov |
| Keywords | stylelint-plugin, stylelint, css, lint, order |

## Links

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

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) ^8.5.8
- [postcss-sorting](https://npm.io/package/postcss-sorting.md) ^10.0.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 8.1.1 (latest) — 2026-03-15
- 8.1.0 — 2026-03-13
- 8.0.0 — 2026-03-09
- 7.0.1 — 2025-12-28
- 7.0.0 — 2025-04-18
- 6.0.4 — 2023-12-08
- 6.0.3 — 2023-03-07
- 6.0.2 — 2023-02-09
- 6.0.1 — 2023-01-06
- 6.0.0 — 2023-01-05
- 5.0.0 — 2021-10-21
- 4.1.0 — 2020-06-01
- 4.0.0 — 2020-01-01
- 3.1.1 — 2019-09-16
- 3.1.0 — 2019-08-30
- … 22 more at https://npm.io/package/stylelint-order/versions

## README

# stylelint-order

[![npm version][npm-version-img]][npm] [![npm downloads last month][npm-downloads-img]][npm]

A plugin pack of order-related linting rules for [Stylelint]. Every rule supports autofixing (`stylelint --fix`).

## Installation

1. If you haven't, install [Stylelint]:

```
npm install stylelint --save-dev
```

2.  Install `stylelint-order`:

```
npm install stylelint-order --save-dev
```

## Usage

Add `stylelint-order` to your Stylelint config `plugins` array, then add rules you need to the rules list. All rules from stylelint-order need to be namespaced with `order`.

```json
{
	"plugins": [
		"stylelint-order"
	],
	"rules": {
		"order/order": [
			"custom-properties",
			"declarations"
		],
		"order/properties-order": [
			"width",
			"height"
		]
	}
}
```

## Rules

* [`order`](./rules/order/README.md): Specify the order of content within declaration blocks.
* [`properties-order`](./rules/properties-order/README.md): Specify the order of properties within declaration blocks.
* [`properties-alphabetical-order`](./rules/properties-alphabetical-order/README.md): Specify the alphabetical order of properties within declaration blocks.
* [`custom-properties-alphabetical-order`](./rules/custom-properties-alphabetical-order/README.md): Specify the alphabetical order of custom properties (CSS variables) within declaration blocks.

## Autofixing

Every rule supports autofixing with `stylelint --fix`. [postcss-sorting] is used internally for order autofixing.

Automatic sorting has some limitations that are described for every rule, if any. Please, take a look at [how comments are handled](https://github.com/hudochenkov/postcss-sorting#handling-comments) by `postcss-sorting`.

CSS-in-JS styles with template interpolation [has limited autofixing](https://github.com/hudochenkov/postcss-sorting#css-in-js) to avoid style corruption.

Autofixing in Less syntax may work but isn't officially supported.

## Example configs

All these configs have `properties-order` configured  with logical properties groups:

* [`stylelint-config-idiomatic-order`](https://github.com/ream88/stylelint-config-idiomatic-order)
* [`stylelint-config-hudochenkov/order`](https://github.com/hudochenkov/stylelint-config-hudochenkov/blob/master/order.js)
* [`stylelint-config-recess-order`](https://github.com/stormwarning/stylelint-config-recess-order)
* [`stylelint-config-property-sort-order-smacss`](https://github.com/cahamilton/stylelint-config-property-sort-order-smacss)
* [`stylelint-config-clean-order`](https://github.com/kutsan/stylelint-config-clean-order)

## Thanks

`properties-order` and `properties-alphabetical-order` code and README were based on the `declaration-block-properties-order` rule which was a core rule prior to Stylelint 8.0.0.

[npm-version-img]: https://img.shields.io/npm/v/stylelint-order.svg
[npm-downloads-img]: https://img.shields.io/npm/dm/stylelint-order.svg
[npm]: https://www.npmjs.com/package/stylelint-order
[Stylelint]: https://stylelint.io/
[postcss-sorting]: https://github.com/hudochenkov/postcss-sorting

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