refactor(linter/plugins): shorten NodeOrToken | Comment type#16807
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. |
b1f2d7a to
6274182
Compare
64333ca to
bf13eba
Compare
There was a problem hiding this comment.
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.tsby replacing the redundant parameter typeNodeOrToken | Commentwith justNodeOrToken. - Updated affected APIs consistently across:
getTokenBefore,getTokenOrCommentBefore,getTokensBeforegetTokenAfter,getTokenOrCommentAfter,getTokensAftergetTokensBetween,getFirstTokenBetween,getFirstTokensBetween,getLastTokenBetween,getLastTokensBetween
Rationale reflected in the diff
- This aligns with the refactor context that
NodeOrTokenalready includesComment(since #16805), making| Commentredundant.
There was a problem hiding this comment.
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 | CommenttoNodeOrToken - 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.
bf13eba to
393b470
Compare
6274182 to
f567ee7
Compare
393b470 to
f6b9e5d
Compare
f567ee7 to
2ddff0c
Compare
2ddff0c to
395c082
Compare
f6b9e5d to
272c4c9
Compare
272c4c9 to
e35c4a8
Compare
395c082 to
ae67bee
Compare
Merge activity
|
Pure refactor. `| Comment` in `NodeOrToken | Comment` is redundant. Since #16805, `NodeOrToken` = `Node | Token | Comment` anyway. Shorten to just `NodeOrToken`.
e35c4a8 to
e654c13
Compare
ae67bee to
c4fb462
Compare

Pure refactor.
| CommentinNodeOrToken | Commentis redundant. Since #16805,NodeOrToken=Node | Token | Commentanyway. Shorten to justNodeOrToken.