Skip to content

fix(estree): Ensure the same key order for AssignmentPattern#10953

Merged
overlookmotel merged 1 commit intomainfrom
f/ast-key-order
May 12, 2025
Merged

fix(estree): Ensure the same key order for AssignmentPattern#10953
overlookmotel merged 1 commit intomainfrom
f/ast-key-order

Conversation

@leaysgur
Copy link
Member

Part of #9705

With this PR, all AST nodes now have a consistent key order for each node type.
(Checked by https://github.com/leaysgur/oxc_estree_ts-ast-diff-viewer/blob/main/scripts/verify-key-order-oxc.js)

Except for:

  • Literal: regex and bigint keys
  • TSModuleDeclaration: body key is missing when declare module "jq";

Copilot AI review requested due to automatic review settings May 12, 2025 04:48
@graphite-app
Copy link
Contributor

graphite-app bot commented May 12, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-ast Area - AST C-bug Category - Bug labels May 12, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR standardizes the key ordering in various AST node serializers to ensure consistency across the codebase.

  • Reorders fields in BindingRestElement, FormalParametersRest, ArrowFunctionExpressionBody, and AssignmentTargetPropertyIdentifierValue to align with the expected key order.
  • Addresses minor field order discrepancies in TypeScript-specific serialization sections.
Comments suppressed due to low confidence (4)

crates/oxc_ast/src/serialize.rs:613

  • [nitpick] The field order is updated here to place 'decorators' before 'optional' for BindingRestElement. Please verify that this ordering is consistent with the established AST node schema.
decorators: [],

crates/oxc_ast/src/serialize.rs:653

  • [nitpick] The reordering of 'optional' and 'typeAnnotation' fields in FormalParametersRest now aligns with other nodes. Ensure that this change is reflected in the corresponding documentation or tests.
state.serialize_ts_field("optional", &rest.argument.optional);

crates/oxc_ast/src/serialize.rs:885

  • [nitpick] In ArrowFunctionExpressionBody, swapping the order of 'optional' and 'typeAnnotation' matches the desired key order. Confirm that this update does not affect any downstream consumers.
optional: false,

crates/oxc_ast/src/serialize.rs:906

  • [nitpick] For AssignmentTargetPropertyIdentifierValue, the new ordering between 'optional' and 'typeAnnotation' improves uniformity. It is recommended to double-check that this ordering change is aligned with the overall AST serialization standards.
state.serialize_ts_field("optional", &False(()));

@codspeed-hq
Copy link

codspeed-hq bot commented May 12, 2025

CodSpeed Instrumentation Performance Report

Merging #10953 will not alter performance

Comparing f/ast-key-order (d57de1a) with main (bed3f47)

Summary

✅ 36 untouched benchmarks

Copy link
Member

@overlookmotel overlookmotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@overlookmotel overlookmotel merged commit d036cf5 into main May 12, 2025
26 checks passed
@overlookmotel overlookmotel deleted the f/ast-key-order branch May 12, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants