Skip to content

useSortedProperties

Enforce ordering of CSS properties and nested rules.

This rule ensures the contents of a CSS rule are ordered consistently.

Properties are ordered semantically, with more important properties near the top and similar properties grouped together. Nested rules and at-rules are placed after properties.

The ordering is roughly:

  1. Custom properties
  2. Layout properties (display, flex, grid)
  3. Margin and padding properties
  4. Typography properties (font, color)
  5. Interaction properties (pointer-events, visibility)
  6. Background and border properties
  7. Transition and animation properties
  8. Nested rules, media queries and other at-rules
p {
transition: opactity 1s ease;
border: 1px solid black;
pointer-events: none;
color: black;
margin: 8px;
display: block;
--custom: 100;
}
p {
span { color: blue; }
color: red;
}
p {
--custom100;
displayblock;
margin8px;
color: black;
pointer-eventsnone;
border1px·solid·black;
transition:·opactity·1s·ease;
}
p {
color: red;
span { color: blue; }
}
biome.json
{
"linter": {
"rules": {
"source": {
"useSortedProperties": "error"
}
}
}
}