Skip to content

Conversation

@yjoer
Copy link
Contributor

@yjoer yjoer commented Oct 18, 2025

What changed / motivation ?

I extracted property-priorities into a public package because the existing package doesn't seem to bundle its dependencies. Keeping the shared package private would result in resolution failures in downstream projects since the code wouldn't be accessible. To support stylex.when selectors, the first call argument is extracted as the property name, and the subsequent processing follows the same flow as for identifier and literal properties.

Linked PR/Issues

Fixes #1285

Pre-flight checklist

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 18, 2025
@yjoer
Copy link
Contributor Author

yjoer commented Oct 19, 2025

On top of that, I have wired up the shorthand before longhand and logical properties before physical properties rules in property-priorities to the default order. It was alphabetical previously for these non-at-rules, non-pseudo-elements, and non-pseudo-classes properties. It is now arranged according to those four categories and falls back to alphabetical order for properties having the same priority.

For stylex.when selectors, I have extracted the relation (ancestor, descendant, anySibling, siblingBefore, siblingAfter) within the callee in addition to the call argument to help retrieve a more precise priority. If the relation is unknown, i.e., owing to a dynamically specified property, it will fall back to alphabetical order.

@mellyeliu
Copy link
Member

Overall this looks great, and an important change with stylex.when priorities being more on the arbitrary side. Let me think a bit more about what we want to do with the shared package. It's a bit confusing to have half of the old shared package within the babel-plugin alongside a top-level public shared package, perhaps we can consider moving it all out again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[eslint-plugin] Have sort-keys respect priorities

2 participants