Skip to content

fix(ast_tools): fix formatting of variants#17173

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-fix_ast_tools_fix_formatting_of_variants
Dec 20, 2025
Merged

fix(ast_tools): fix formatting of variants#17173
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-fix_ast_tools_fix_formatting_of_variants

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 20, 2025

Fix formatting of generated JS files. Previously we inserted line breaks before top-level export statements. Now insert the line break before any comments that precede those statements. This produces nicer output.

Copy link
Member Author

overlookmotel commented Dec 20, 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.

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 fixes the formatting of generated JavaScript files by improving how line breaks are inserted before top-level declarations. Previously, line breaks were inserted directly before export, function, class, const, or let keywords. The new implementation inserts line breaks before any comments that precede these statements, producing cleaner output.

Key Changes:

  • Updated regex pattern to match and preserve comments preceding export/function/class/const/let declarations
  • Simplified replacement logic from a match-based approach to a single format string
  • Updated documentation to explain the new regex behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel self-assigned this Dec 20, 2025
@overlookmotel overlookmotel force-pushed the om/12-20-fix_ast_tools_fix_formatting_of_variants branch from daabe4a to 101b8a6 Compare December 20, 2025 13:16
@overlookmotel overlookmotel force-pushed the om/12-19-refactor_ast_tools_simplify_generating_variants_of_code branch from 4e99696 to fff03fc Compare December 20, 2025 13:16
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 20, 2025

Merge activity

Fix formatting of generated JS files. Previously we inserted line breaks before top-level `export` statements. Now insert the line break before any comments that precede those statements. This produces nicer output.
@graphite-app graphite-app bot force-pushed the om/12-19-refactor_ast_tools_simplify_generating_variants_of_code branch from fff03fc to 472c439 Compare December 20, 2025 14:00
@graphite-app graphite-app bot requested a review from camc314 as a code owner December 20, 2025 14:00
@graphite-app graphite-app bot force-pushed the om/12-20-fix_ast_tools_fix_formatting_of_variants branch from 101b8a6 to bc8ab2e Compare December 20, 2025 14:00
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Base automatically changed from om/12-19-refactor_ast_tools_simplify_generating_variants_of_code to main December 20, 2025 14:07
@graphite-app graphite-app bot merged commit bc8ab2e into main Dec 20, 2025
19 checks passed
@graphite-app graphite-app bot deleted the om/12-20-fix_ast_tools_fix_formatting_of_variants branch December 20, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants