refactor(ast/estree): re-order fields in visitation order#11362
Merged
graphite-app[bot] merged 1 commit intomainfrom May 29, 2025
Merged
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #11362 will create unknown performance changesComparing Summary
Benchmarks breakdown
|
Member
Merge activity
|
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.
5e1cb06 to
1d1ebd6
Compare
aaf25cb to
12690a1
Compare
Base automatically changed from
05-28-refactor_ast_tools_estree_order_type_and_span_fields_first_by_default
to
main
May 29, 2025 02:28
overlookmotel
pushed a commit
that referenced
this pull request
Jun 2, 2025
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 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-test262in order to produce test cases for decorators.Visitation order aligns with TS-ESLint except for the following types:
ExportSpecifierTSImportTypeTSIndexedAccessTypeTSMethodSignatureTSPropertySignatureTSTypePredicateIn these 6 cases, TS-ESLint's
visitorKeyshas 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-test262to include oxc-project/estree-conformance#37 which re-orders the fields in fixture snapshots to match the new field order here.