-
-
Notifications
You must be signed in to change notification settings - Fork 722
refactor(linter/plugins): simplify comments getter
#14728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(linter/plugins): simplify comments getter
#14728
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this 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.
|
@lilnasy Could you please review? I think this makes sense. |
CodSpeed Performance ReportMerging #14728 will not alter performanceComparing Summary
|
lilnasy
left a comment
There was a problem hiding this 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.
Merge activity
|
46639a3 to
14de671
Compare

Follow-on after #14727.
Since we now have to call into deserializer module to update
astIdat end of linting a file, we may as well reset the buffers at that point too. This allows simplifying thecommentsgetter.