A derivation and fork of stylelint-order
. Provides one rule, properties-alphabetical-clockwise-order
, which sorts all properties alphabetically except long-form properties containing -top
, -right
, -bottom
, or -left
, which are sorted in that order.
Autofixing is still enabled, but still corrects to strictly alphabetical ordering. (TODO: #1 Update autofix to handle alpha-clockwise)
- If you haven't, install stylelint:
npm install stylelint --save-dev
- Install
stylelint-alphabetical-clockwise-order
:
npm install stylelint-alphabetical-clockwise-order --save-dev
Add stylelint-alphabetical-clockwise-order
to your stylelint config plugins
array, then add the plugin/properties-alphabetical-clockwise-order
rule to the rules list (note the namespace).
{
"plugins": [
"stylelint-alphabetical-clockwise-order"
],
"rules": {
"plugin/properties-alphabetical-clockwise-order": true
}
}
properties-alphabetical-clockwise-order
: Specify the alphabetical-clockwise order of properties within declaration blocks.
Autofixing is enabled by default if it's enabled in stylelint's configuration file. It can be disabled on a per rule basis using the secondary option disableFix: true
. Here's an example:
"rules": {
"plugin/alphabetical-clockwise-order": [
true,
{
"disableFix": true
}
]
}
Less may work but isn't officially supported.