Merged
Conversation
graphite-app bot
pushed a commit
to oxc-project/oxc
that referenced
this pull request
May 29, 2025
Re-order fields in ESTree and TS-ESTree ASTs to be in visitation order (which is the order in which they're defined in Rust types). This does not align with either Acorn or TS-ESLint, but for the reasons discussed in #9705 (comment), I feel this isn't a concern. The field order doesn't matter much per se, only that it's consistent, and this change has other benefits - it will make it simpler to build a visitor which visits fields in the correct order, and allows adding other parsers to `acorn-test262` in order to produce test cases for decorators. Visitation order aligns with TS-ESLint except for the following types: * `ExportSpecifier` * `TSImportType` * `TSIndexedAccessType` * `TSMethodSignature` * `TSPropertySignature` * `TSTypePredicate` In these 6 cases, TS-ESLint's `visitorKeys` has the wrong visitation order, because it does not visit fields in source order. I will open an issue and hopefully they can fix. This PR also bumps `acorn-test262` to include oxc-project/estree-conformance#37 which re-orders the fields in fixture snapshots to match the new field order here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Re-order fields of all AST nodes in snapshots according to defined field orders derived from Oxc.
The field orders we're using come from the field order in Oxc's Rust types, which have been put in visitation order. This matches the visitation order of TS-ESLint, with the following exceptions:
ExportSpecifierTSImportTypeTSIndexedAccessTypeTSMethodSignatureTSPropertySignatureTSTypePredicateIn these types, TS-ESLint's
visitorKeyshas the wrong visitation order, because it does not visit fields in source order.The JSON file specifying field orders was produced by codegen in https://github.com/oxc-project/oxc/tree/overlookmotel/estree-field-orders (commit oxc-project/oxc@fcb73d8).