Open-source IoT Platform - Device management, data collection, processing and visualization.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Artem Halushko f8af340464 pulled with master 7 years ago
..
rules pulled with master 7 years ago
utils pulled with master 7 years ago
CHANGELOG.md pulled with master 7 years ago
LICENSE.md pulled with master 7 years ago
README.md pulled with master 7 years ago
index.js pulled with master 7 years ago
package.json pulled with master 7 years ago

README.md

stylelint-order Build Status npm version npm downloads last month

A plugin pack of order related linting rules for stylelint. Every rule support autofixing (stylelint --fix).

Installation

First, install stylelint:

npm install stylelint --save-dev

Then install plugin:

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.

Like so:

// .stylelintrc
{
	"plugins": [
		"stylelint-order"
	],
	"rules": {
		// ...
		"order/order": [
			"custom-properties",
			"declarations"
		],
		"order/properties-alphabetical-order": true
		// ...
	}
}

List of rules

Autofixing

Every rule support autofixing (stylelint --fix). postcss-sorting is using internally for order autofixing.

Automatic sortings has some limitation, which are described for every rule if any. Please, take a look at how comments are handled by postcss-sorting.

CSS-in-JS styles with template interpolation could be ignored by autofixing to avoid styles corruption.

Autofixing is enabled by default if it's enabled in stylelint configuration. Autofixing can be disabled on per rule basis using disableFix: true secondary option. E. g.:

{
	"rules": {
		"order/order": [
			[
				"custom-properties",
				"declarations"
			],
			{
				"disableFix": true
			}
		]
	}
}

Less isn't supported. It might work, but haven't tested.

Thanks

properties-order and properties-alphabetical-order code and readme are based on declaration-block-properties-order rule which was a stylelint's core rule prior stylelint 8.0.0.