Skip to content

Comments

refactor(linter/plugins): more debug assertions in initTokensWithComments#16116

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-25-refactor_linter_plugins_more_debug_assertions_in_inittokenswithcomments_
Nov 25, 2025
Merged

refactor(linter/plugins): more debug assertions in initTokensWithComments#16116
graphite-app[bot] merged 1 commit intomainfrom
11-25-refactor_linter_plugins_more_debug_assertions_in_inittokenswithcomments_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 25, 2025

Follow-on after #16071. Add more debug assertions to ensure comments and tokens are merged correctly. This code is removed in release build - just for tests.

Copy link
Member Author


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 A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 25, 2025
@overlookmotel overlookmotel marked this pull request as ready for review November 25, 2025 18:08
Copilot AI review requested due to automatic review settings November 25, 2025 18:08
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 refactors debug assertions in the initTokensWithComments function by extracting the validation logic into a separate debugCheckTokensWithComments function. The new function provides more comprehensive checks that verify not only the length but also the correct ordering of merged tokens and comments. These assertions are only active in debug builds and are completely removed by the minifier in production.

Key Changes:

  • Extracted debug validation logic into a dedicated debugCheckTokensWithComments function
  • Enhanced validation to verify both length and ordering of merged tokens/comments
  • Added check to detect duplicate token/comment start positions

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

@overlookmotel overlookmotel self-assigned this Nov 25, 2025
@overlookmotel overlookmotel force-pushed the 11-25-refactor_linter_plugins_more_debug_assertions_in_inittokenswithcomments_ branch from b0d1695 to 14f7b51 Compare November 25, 2025 18:18
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 25, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 25, 2025

Merge activity

…ments` (#16116)

Follow-on after #16071. Add more debug assertions to ensure `comments` and `tokens` are merged correctly. This code is removed in release build - just for tests.
@graphite-app graphite-app bot force-pushed the 11-25-refactor_linter_plugins_more_debug_assertions_in_inittokenswithcomments_ branch from 14f7b51 to 74e1f3d Compare November 25, 2025 18:33
@graphite-app graphite-app bot merged commit 74e1f3d into main Nov 25, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 11-25-refactor_linter_plugins_more_debug_assertions_in_inittokenswithcomments_ branch November 25, 2025 18:38
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 25, 2025
leaysgur pushed a commit that referenced this pull request Nov 26, 2025
…ments` (#16116)

Follow-on after #16071. Add more debug assertions to ensure `comments` and `tokens` are merged correctly. This code is removed in release build - just for tests.
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…ments` (oxc-project#16116)

Follow-on after oxc-project#16071. Add more debug assertions to ensure `comments` and `tokens` are merged correctly. This code is removed in release build - just for tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant