-
-
Notifications
You must be signed in to change notification settings - Fork 474
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
feat(biome_css_analyze): add rule useSortedProperties
#4063
base: main
Are you sure you want to change the base?
Conversation
useSortedProperties
useSortedProperties
useSortedProperties
CodSpeed Performance ReportMerging #4063 will degrade performances by 19.89%Comparing Summary
Benchmarks breakdown
|
Thank you @simon-paris for the contribution. I will look into this rule this week. As a very early feedback, this rule should be made an assist (apologies for the lack of documentation, I will try to fix that ASAP). Here's an example of assist: https://github.com/biomejs/biome/blob/main/crates/biome_json_analyze/src/assists/source/use_sorted_keys.rs |
Summary
Related: #3 (comment), #3167
This implements CSS declaration and rule sorting from the
stylelint-order
plugin. It sorts properties (and nested rules) in a consistent order, e.g:The property order comes from the most popular preset config:
stylelint-config-recess-order
.This is the equivalent stylelint config:
The sort order is this: (ties stay in the same relative order)
a. Custom properties
b. The "composes" property
c. Properties
e. Nested rules and at-rules
f. Other
a. By the order defined in PROPERTY_ORDER
a. By the order defined in VENDOR_PREFIXES
b. Properties with no vendor prefix
Some possible issues:
LazyLock<HashMap>
to implement some lookup tables for this rule. Not sure if that's a good method, I'm new to rust.Test Plan
Unit tests are included.