useSortedProperties
Summary
Section titled Summary- Diagnostic Category:
assist/source/useSortedProperties
- Use the code
source.biome.useSortedProperties
in your LSP-ready IDE to apply this action on save. - The default severity of this rule is information.
Description
Section titled DescriptionEnforce 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:
- Custom properties
- Layout properties (display, flex, grid)
- Margin and padding properties
- Typography properties (font, color)
- Interaction properties (pointer-events, visibility)
- Background and border properties
- Transition and animation properties
- Nested rules, media queries and other at-rules
Examples
Section titled ExamplesInvalid
Section titled Invalidp { 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;}
Valid
Section titled Validp { --custom:·100; display:·block; margin:·8px; color: black; pointer-events:·none; border:·1px·solid·black; transition:·opactity·1s·ease;}
p { color: red; span { color: blue; }}
How to configure
Section titled How to configure{ "linter": { "rules": { "source": { "useSortedProperties": "error" } } }}