1. stylelint-order
A collection of order related linting rules for Stylelint.
stylelint-order
Package: stylelint-order
Created by: hudochenkov
Last modified: Fri, 08 Dec 2023 19:33:17 GMT
Version: 6.0.4
License: MIT
Downloads: 6,459,392
Repository: https://github.com/hudochenkov/stylelint-order

Install

npm install stylelint-order
yarn add stylelint-order

stylelint-order

npm version npm downloads last month

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
  1. 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.

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

Rules

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 by postcss-sorting.

CSS-in-JS styles with template interpolation could be ignored by autofixing 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:

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.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin