Skip to content

Sort object members in typegen#3808

Closed
MaartenStaa wants to merge 2 commits intofacebook:mainfrom
MaartenStaa:typegen-sort-object-members
Closed

Sort object members in typegen#3808
MaartenStaa wants to merge 2 commits intofacebook:mainfrom
MaartenStaa:typegen-sort-object-members

Conversation

@MaartenStaa
Copy link
Copy Markdown
Contributor

@MaartenStaa MaartenStaa commented Feb 22, 2022

Trying to start split #3280 into smaller parts. When writing objects (whether exact or inexact) in typegen, sort the object's members by name. The used sorting is a bit subjective, so I'm open to suggestions.

@rbalicki2

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@rbalicki2 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@rbalicki2
Copy link
Copy Markdown
Contributor

rbalicki2 commented Feb 24, 2022

Love it! Thank you for doing this!!! This is going to make changes in the future so much easier to land. I might make some minor changes on my end — using descriptive constants in sort_props, and potentially avoiding a clone by sorting when the AST::[In]ExactObject is created, but besides those nits, this looks great!!

Can you also put up a diff to sort the items in union and intersection types, and to sort FragmentReference types?

I think these ordering diffs + adding parentheses around union and intersection types can all land at once, and be rolled out slowly (but as a unit) internally.

@MaartenStaa MaartenStaa deleted the typegen-sort-object-members branch April 29, 2022 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants