Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify the order of content within declaration blocks #60

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ check for properties order:
}
```

The `order` config enforces properties order given by following categories:
The `order` config enforces a consistent order of content in your declaration blocks:

1. Sass variables,
2. CSS custom properties,
adamkudrna marked this conversation as resolved.
Show resolved Hide resolved
3. Sass `@extend`,
4. single-line Sass `@include`,
5. declarations,
6. nested rules,
7. any other at-rules.

Furthermore, properties in the declarations must be ordered by following categories:

1. `all` properties,
2. `content`,
Expand Down
19 changes: 19 additions & 0 deletions order.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ module.exports = {
'stylelint-order',
],
rules: {
'order/order': [
'dollar-variables',
'custom-properties',
{
name: 'extend',
type: 'at-rule',
},
{
hasBlock: false,
name: 'include',
type: 'at-rule',
},
'declarations',
'rules',
{
hasBlock: true,
type: 'at-rule',
},
],
'order/properties-order': [

// All properties
Expand Down