Skip to content

refactor(linter/plugins): move comments methods into own file#20363

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-13-refactor_linter_plugins_move_comments_methods_into_own_file
Mar 14, 2026
Merged

refactor(linter/plugins): move comments methods into own file#20363
graphite-app[bot] merged 1 commit intomainfrom
om/03-13-refactor_linter_plugins_move_comments_methods_into_own_file

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 14, 2026

Pure refactor. Move sourceCode methods related to comments into a separate file comments_methods.ts. Does not alter any of the code, just moves it.

Copy link
Member Author

overlookmotel commented Mar 14, 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.

@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 Mar 14, 2026
@overlookmotel overlookmotel marked this pull request as ready for review March 14, 2026 01:40
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 14, 2026 01:40
Copilot AI review requested due to automatic review settings March 14, 2026 01:40
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

A pure refactor that extracts SourceCode comment-related methods from comments.ts into a dedicated comments_methods.ts file, mirroring the existing pattern of tokens.ts / tokens_methods.ts. A small safety check is also added to the inline_search build plugin.

Changes:

  • Moved comment query methods (getAllComments, getCommentsBefore, getCommentsAfter, getCommentsInside, commentsExistBetween, getJSDocComment) into a new comments_methods.ts file.
  • Updated imports in source_code.ts and the inline_search tsdown plugin to reference the new file path.
  • Added a build-time assertion in inline_search.ts to fail if no firstTokenAtOrAfter calls are found for inlining.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
apps/oxlint/src-js/plugins/comments_methods.ts New file containing comment-related SourceCode methods moved from comments.ts
apps/oxlint/src-js/plugins/comments.ts Removed moved methods; updated module-level comment
apps/oxlint/src-js/plugins/source_code.ts Updated commentMethods import to point to comments_methods.ts
apps/oxlint/tsdown_plugins/inline_search.ts Updated FILES path and added a safety check for zero inlined calls

@overlookmotel overlookmotel self-assigned this Mar 14, 2026
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 14, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 14, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the om/03-13-perf_linter_plugins_recycle_comment_objects branch from 9a256b8 to 53acd73 Compare March 14, 2026 12:16
graphite-app bot pushed a commit that referenced this pull request Mar 14, 2026
Pure refactor. Move `sourceCode` methods related to comments into a separate file `comments_methods.ts`. Does not alter any of the code, just moves it.
@graphite-app graphite-app bot force-pushed the om/03-13-refactor_linter_plugins_move_comments_methods_into_own_file branch from 70b2361 to 159c3e2 Compare March 14, 2026 12:17
Pure refactor. Move `sourceCode` methods related to comments into a separate file `comments_methods.ts`. Does not alter any of the code, just moves it.
@graphite-app graphite-app bot force-pushed the om/03-13-perf_linter_plugins_recycle_comment_objects branch from 53acd73 to 9cd612f Compare March 14, 2026 12:20
@graphite-app graphite-app bot force-pushed the om/03-13-refactor_linter_plugins_move_comments_methods_into_own_file branch from 159c3e2 to ef41ffa Compare March 14, 2026 12:20
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 14, 2026
Base automatically changed from om/03-13-perf_linter_plugins_recycle_comment_objects to main March 14, 2026 12:31
@graphite-app graphite-app bot merged commit ef41ffa into main Mar 14, 2026
20 checks passed
@graphite-app graphite-app bot deleted the om/03-13-refactor_linter_plugins_move_comments_methods_into_own_file branch March 14, 2026 12:32
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.

2 participants