Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Sep 17, 2025

Partial fix for #13851.

Add a preserveParens argument to raw transfer deserialize functions. This is not useful in oxc-parser, but these generated files will be duplicated in oxlint, where this option is required to remove ParenthesizedExpressions from AST, to align with ESLint and TS-ESLint.

Copy link
Member Author

overlookmotel commented Sep 17, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Sep 17, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 17, 2025

CodSpeed Instrumentation Performance Report

Merging #13855 will not alter performance

Comparing 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer (24a21b3) with main (5c3645b)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (24a21b3) during the generation of this report, so 5c3645b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@graphite-app graphite-app bot changed the base branch from 09-17-refactor_napi_parser_export_functions_directly to graphite-base/13855 September 17, 2025 11:16
@graphite-app graphite-app bot force-pushed the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch from ec45f78 to b478cc2 Compare September 17, 2025 11:21
@graphite-app graphite-app bot force-pushed the graphite-base/13855 branch from 38e0b2e to 42b1000 Compare September 17, 2025 11:21
@graphite-app graphite-app bot changed the base branch from graphite-base/13855 to main September 17, 2025 11:22
@graphite-app graphite-app bot force-pushed the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch from b478cc2 to 469dafa Compare September 17, 2025 11:22
@overlookmotel overlookmotel marked this pull request as ready for review September 17, 2025 11:22
Copilot AI review requested due to automatic review settings September 17, 2025 11:22
@overlookmotel overlookmotel self-assigned this Sep 17, 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 adds a preserveParens option to raw transfer deserialize functions to control whether ParenthesizedExpression nodes are included in the generated AST. This change prepares the codebase for use in oxlint where the option is needed to align with ESLint and TS-ESLint behavior.

  • Adds preserveParens parameter to deserialize functions in the raw transfer generator
  • Updates deserialize function calls to pass true for preserveParens to maintain current behavior
  • Implements custom converter for ParenthesizedExpression that conditionally creates nodes based on the preserveParens flag

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/ast_tools/src/generators/raw_transfer.rs Adds preserveParens parameter to generated deserialize function template
napi/parser/raw-transfer/eager.mjs Updates deserialize calls to pass preserveParens: true with explanatory comments
napi/parser/bench.bench.mjs Updates benchmark deserialize call to include new preserveParens parameter
crates/oxc_ast/src/serialize/js.rs Implements custom ParenthesizedExpressionConverter with conditional node creation
crates/oxc_ast/src/ast/js.rs Configures ParenthesizedExpression to use the new converter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@overlookmotel overlookmotel added A-parser Area - Parser 0-merge Merge with Graphite Merge Queue labels Sep 17, 2025
Copy link
Member Author

overlookmotel commented Sep 17, 2025

Merge activity

  • Sep 17, 11:22 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 17, 11:27 AM UTC: overlookmotel added this pull request to the Graphite merge queue.
  • Sep 17, 11:32 AM UTC: The Graphite merge queue couldn't merge this PR because it was in draft mode.
  • Sep 17, 11:33 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 17, 11:38 AM UTC: overlookmotel added this pull request to the Graphite merge queue.
  • Sep 17, 11:43 AM UTC: Merged by the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Sep 17, 2025
Partial fix for #13851. Add a `preserveParens` argument to raw transfer `deserialize` functions. This is not useful in `oxc-parser`, but these generated files will be duplicated in `oxlint`, where this option is required to remove `ParenthesizedExpression`s from AST, to align with ESLint and TS-ESLint.
@graphite-app graphite-app bot force-pushed the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch from 469dafa to d042710 Compare September 17, 2025 11:28
@overlookmotel overlookmotel marked this pull request as draft September 17, 2025 11:31
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 17, 2025
@overlookmotel overlookmotel force-pushed the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch from d042710 to e1a1b6b Compare September 17, 2025 11:32
@overlookmotel overlookmotel marked this pull request as ready for review September 17, 2025 11:33
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Sep 17, 2025
Partial fix for #13851.

Add a `preserveParens` argument to raw transfer `deserialize` functions. This is not useful in `oxc-parser`, but these generated files will be duplicated in `oxlint`, where this option is required to remove `ParenthesizedExpression`s from AST, to align with ESLint and TS-ESLint.
@graphite-app graphite-app bot force-pushed the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch from e1a1b6b to 24a21b3 Compare September 17, 2025 11:38
@graphite-app graphite-app bot merged commit 24a21b3 into main Sep 17, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 09-17-feat_napi_parser_preserveparens_option_for_raw_transfer branch September 17, 2025 11:43
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 17, 2025
graphite-app bot pushed a commit that referenced this pull request Sep 21, 2025
…renthesizedType` (#13964)

Partial fix for #13851.

Raw transfer `preserveParens` option remove `TSParenthesizedType`s from AST, same as #13855 removed `ParenthesizedExpression`s.

This is not used in `oxc-parser`, but the raw transfer `preserveParens` option is required in `oxlint` JS plugins, to align with TS-ESLint, which has no `TSParenthesizedType`s in its AST.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-parser Area - Parser C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants