Skip to content

refactor(linter/plugins): import getNodeLoc instead of injecting it#21026

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it
Apr 3, 2026
Merged

refactor(linter/plugins): import getNodeLoc instead of injecting it#21026
graphite-app[bot] merged 1 commit intomainfrom
om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 3, 2026

Refacfor. In a strange pattern, we were injecting getNodeLoc into deserialize.js module on every call to deserializeProgramOnly. It's a static function, so just import it.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 3, 2026


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 changes, fast-track this PR to the front of 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.

@overlookmotel overlookmotel marked this pull request as ready for review April 3, 2026 21:47
@overlookmotel overlookmotel requested a review from camc314 as a code owner April 3, 2026 21:47
@github-actions github-actions bot added A-linter Area - Linter A-parser Area - Parser A-cli Area - CLI A-ast-tools Area - AST tools A-linter-plugins Area - Linter JS plugins labels Apr 3, 2026
Copilot AI review requested due to automatic review settings April 3, 2026 21:47
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Apr 3, 2026
Copy link
Copy Markdown
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 the raw-transfer deserializer generation to stop injecting a getLoc callback into the linter deserializer entrypoint, and instead have the generated linter deserializer use a static getNodeLoc implementation.

Changes:

  • Generate linter deserializer code that imports and uses getNodeLoc directly, removing the getLoc/GetLoc injection plumbing.
  • Update oxlint’s initAst() to call deserializeProgramOnly without passing getNodeLoc.
  • Regenerate napi/parser deserializers to drop the now-unused getLocInput parameter path in deserializeWith.

Reviewed changes

Copilot reviewed 2 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tasks/ast_tools/src/generators/raw_transfer.rs Updates the deserializer generator template to import getNodeLoc and removes the injected getLoc parameter/type.
napi/parser/src-js/generated/deserialize/ts.js Regenerated parser deserializer to remove unused getLocInput from deserializeWith.
napi/parser/src-js/generated/deserialize/ts_range.js Same regeneration change (range variant).
napi/parser/src-js/generated/deserialize/ts_range_parent.js Same regeneration change (range+parent variant).
napi/parser/src-js/generated/deserialize/ts_parent.js Same regeneration change (parent variant).
napi/parser/src-js/generated/deserialize/js.js Same regeneration change (JS variant).
napi/parser/src-js/generated/deserialize/js_range.js Same regeneration change (JS range variant).
napi/parser/src-js/generated/deserialize/js_range_parent.js Same regeneration change (JS range+parent variant).
napi/parser/src-js/generated/deserialize/js_parent.js Same regeneration change (JS parent variant).
apps/oxlint/src-js/plugins/source_code.ts Removes passing getNodeLoc into deserializeProgramOnly.
apps/oxlint/src-js/generated/deserialize.js Generated linter deserializer now imports getNodeLoc and removes getLoc injection state.
apps/oxlint/src-js/generated/deserialize.d.ts Updates the public typings for deserializeProgramOnly to remove the getLoc parameter.

@overlookmotel overlookmotel force-pushed the om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it branch from aeab5d1 to 7111ad4 Compare April 3, 2026 21:56
@overlookmotel overlookmotel force-pushed the om/04-03-perf_napi_parser_linter_plugins_clear_buffers_and_source_texts_earlier branch from 2f73eb9 to 3a33c7d Compare April 3, 2026 21:56
@overlookmotel overlookmotel force-pushed the om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it branch from 7111ad4 to 31c6baf Compare April 3, 2026 21:58
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Apr 3, 2026

Merge activity

@overlookmotel overlookmotel self-assigned this Apr 3, 2026
…#21026)

Refacfor. In a strange pattern, we were injecting `getNodeLoc` into `deserialize.js` module on every call to `deserializeProgramOnly`. It's a static function, so just import it.
@graphite-app graphite-app bot force-pushed the om/04-03-perf_napi_parser_linter_plugins_clear_buffers_and_source_texts_earlier branch from 3a33c7d to fb52383 Compare April 3, 2026 22:08
@graphite-app graphite-app bot force-pushed the om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it branch from 31c6baf to a4ac3ce Compare April 3, 2026 22:09
Base automatically changed from om/04-03-perf_napi_parser_linter_plugins_clear_buffers_and_source_texts_earlier to main April 3, 2026 22:19
@graphite-app graphite-app bot merged commit a4ac3ce into main Apr 3, 2026
25 checks passed
@graphite-app graphite-app bot deleted the om/04-03-refactor_linter_plugins_import_getnodeloc_instead_of_injecting_it branch April 3, 2026 22:20
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 A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins 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.

2 participants