Skip to content

refactor(linter/plugins): shorten NodeOrToken | Comment type#16807

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type
Dec 13, 2025
Merged

refactor(linter/plugins): shorten NodeOrToken | Comment type#16807
graphite-app[bot] merged 1 commit intomainfrom
12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 13, 2025

Pure refactor. | Comment in NodeOrToken | Comment is redundant. Since #16805, NodeOrToken = Node | Token | Comment anyway. Shorten to just NodeOrToken.

@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 Dec 13, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 13, 2025


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.

@overlookmotel overlookmotel force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from b1f2d7a to 6274182 Compare December 13, 2025 18:42
@overlookmotel overlookmotel force-pushed the 12-13-feat_linter_plugins_do_not_export_nodeortoken_type branch from 64333ca to bf13eba Compare December 13, 2025 18:42
@overlookmotel overlookmotel self-assigned this Dec 13, 2025
@overlookmotel overlookmotel marked this pull request as ready for review December 13, 2025 18:46
Copilot AI review requested due to automatic review settings December 13, 2025 18:46
Copy link
Copy Markdown

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

No issues found. The refactor is consistent, purely type-level, and removes redundant unions without changing runtime behavior.

Summary of changes

What changed

  • Simplified several public token helper function signatures in apps/oxlint/src-js/plugins/tokens.ts by replacing the redundant parameter type NodeOrToken | Comment with just NodeOrToken.
  • Updated affected APIs consistently across:
    • getTokenBefore, getTokenOrCommentBefore, getTokensBefore
    • getTokenAfter, getTokenOrCommentAfter, getTokensAfter
    • getTokensBetween, getFirstTokenBetween, getFirstTokensBetween, getLastTokenBetween, getLastTokensBetween

Rationale reflected in the diff

  • This aligns with the refactor context that NodeOrToken already includes Comment (since #16805), making | Comment redundant.

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 simplifies type signatures by removing redundant | Comment unions from function parameters. Since NodeOrToken is already defined as Node | Token | Comment in types.ts, the | Comment suffix is unnecessary and can be safely removed without changing the semantic meaning of the types.

Key Changes:

  • Simplified 16 function parameter type declarations from NodeOrToken | Comment to NodeOrToken
  • All changes are in apps/oxlint/src-js/plugins/tokens.ts
  • No functional changes - purely a type signature refactor

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

@graphite-app graphite-app bot force-pushed the 12-13-feat_linter_plugins_do_not_export_nodeortoken_type branch from bf13eba to 393b470 Compare December 13, 2025 18:59
@graphite-app graphite-app bot force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from 6274182 to f567ee7 Compare December 13, 2025 18:59
@overlookmotel overlookmotel changed the base branch from 12-13-feat_linter_plugins_do_not_export_nodeortoken_type to graphite-base/16807 December 13, 2025 21:13
@overlookmotel overlookmotel force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from f567ee7 to 2ddff0c Compare December 13, 2025 21:14
@overlookmotel overlookmotel changed the base branch from graphite-base/16807 to 12-13-feat_linter_plugins_do_not_export_nodeortoken_type December 13, 2025 21:14
@overlookmotel overlookmotel changed the base branch from 12-13-feat_linter_plugins_do_not_export_nodeortoken_type to graphite-base/16807 December 13, 2025 22:12
@overlookmotel overlookmotel force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from 2ddff0c to 395c082 Compare December 13, 2025 22:12
@overlookmotel overlookmotel changed the base branch from graphite-base/16807 to 12-13-feat_linter_plugins_do_not_export_nodeortoken_type December 13, 2025 22:12
@overlookmotel overlookmotel force-pushed the 12-13-feat_linter_plugins_do_not_export_nodeortoken_type branch from 272c4c9 to e35c4a8 Compare December 13, 2025 22:20
@overlookmotel overlookmotel force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from 395c082 to ae67bee Compare December 13, 2025 22:20
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 13, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 13, 2025

Merge activity

Pure refactor. `| Comment` in `NodeOrToken | Comment` is redundant. Since #16805, `NodeOrToken` = `Node | Token | Comment` anyway. Shorten to just `NodeOrToken`.
@graphite-app graphite-app bot force-pushed the 12-13-feat_linter_plugins_do_not_export_nodeortoken_type branch from e35c4a8 to e654c13 Compare December 13, 2025 22:56
@graphite-app graphite-app bot force-pushed the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch from ae67bee to c4fb462 Compare December 13, 2025 22:56
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 13, 2025
Base automatically changed from 12-13-feat_linter_plugins_do_not_export_nodeortoken_type to main December 13, 2025 23:01
@graphite-app graphite-app bot merged commit c4fb462 into main Dec 13, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-13-refactor_linter_plugins_shorten_nodeortoken_comment_type branch December 13, 2025 23:02
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