Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Oct 17, 2025

Follow-on after #14727.

Since we now have to call into deserializer module to update astId at end of linting a file, we may as well reset the buffers at that point too. This allows simplifying the comments getter.

@github-actions github-actions bot added A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-ast Area - AST A-ast-tools Area - AST tools labels Oct 17, 2025
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 the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Oct 17, 2025
@overlookmotel overlookmotel marked this pull request as ready for review October 17, 2025 13:43
Copilot AI review requested due to automatic review settings October 17, 2025 13:43
@overlookmotel overlookmotel self-assigned this Oct 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

Refactor to simplify the Program.comments getter by deferring buffer cleanup to a centralized reset function invoked at the end of linting.

  • Introduces resetBuffer to clear deserializer buffers and bump astId when comments are enabled.
  • Simplifies the comments getter to directly deserialize once without juggling buffer references.
  • Updates oxlint plugin to call resetBuffer after finishing with a file.

Reviewed Changes

Copilot reviewed 3 out of 12 changed files in this pull request and generated 1 comment.

File Description
tasks/ast_tools/src/generators/raw_transfer.rs Adds resetBuffer and updates deserialize/deserializeWith flow to centralize cleanup; calls resetBuffer in non-linter path.
crates/oxc_ast/src/serialize/mod.rs Simplifies comments getter; removes captured buffer references; introduces localAstId without previous COMMENTS guard.
apps/oxlint/src-js/plugins/source_code.ts Switches from reset to resetBuffer when resetting between files.

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

@overlookmotel overlookmotel removed the request for review from camc314 October 17, 2025 13:44
@overlookmotel
Copy link
Member Author

@lilnasy Could you please review? I think this makes sense.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 17, 2025

CodSpeed Performance Report

Merging #14728 will not alter performance

Comparing 10-17-refactor_linter_plugins_simplify_comments_getter (46639a3) with main (47d8db1)

Summary

✅ 37 untouched

Copy link
Contributor

@lilnasy lilnasy left a comment

Choose a reason for hiding this comment

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

I haven't looked at other deserializers - I didn't get into them too deep - but this is nice. I like this a lot better.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Oct 17, 2025
Copy link
Member Author

overlookmotel commented Oct 17, 2025

Merge activity

  • Oct 17, 4:09 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 17, 4:09 PM UTC: overlookmotel added this pull request to the Graphite merge queue.
  • Oct 17, 4:10 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 17, 4:16 PM UTC: Merged by the Graphite merge queue.

Follow-on after #14727.

Since we now have to call into deserializer module to update `astId` at end of linting a file, we may as well reset the buffers at that point too. This allows simplifying the `comments` getter.
@graphite-app graphite-app bot force-pushed the 10-17-refactor_linter_plugins_simplify_comments_getter branch from 46639a3 to 14de671 Compare October 17, 2025 16:09
@graphite-app graphite-app bot merged commit 14de671 into main Oct 17, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 10-17-refactor_linter_plugins_simplify_comments_getter branch October 17, 2025 16:15
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 17, 2025
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-cli Area - CLI A-linter Area - Linter A-parser Area - Parser 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.

3 participants