refactor(linter/plugins): split tokens initialization from tokens methods#19981
Merged
graphite-app[bot] merged 1 commit intomainfrom Mar 3, 2026
Conversation
This was referenced Mar 3, 2026
Member
Author
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. |
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the oxlint JS plugin token utilities by separating token lifecycle/initialization concerns from SourceCode token-query methods, reducing tokens.ts size and clarifying responsibilities.
Changes:
- Added
tokens_methods.tsto hostSourceCode-style token query helpers (e.g.getFirstToken,getTokensBetween,isSpaceBetween). - Trimmed
tokens.tsdown to token types + lazy initialization/deserialization/reset state. - Updated
SourceCodewiring and tests to import token methods from the new module.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/tokens_methods.ts | New module containing token-related SourceCode public methods. |
| apps/oxlint/src-js/plugins/tokens.ts | Removes token-method exports; keeps token types and initialization/reset logic. |
| apps/oxlint/src-js/plugins/source_code.ts | Re-points SourceCode token method mapping to tokens_methods.ts. |
| apps/oxlint/src-js/plugins.ts | Moves exported option-type re-exports (SkipOptions, etc.) to tokens_methods.ts. |
| apps/oxlint/test/tokens.test.ts | Updates imports to pull token methods from tokens_methods.ts. |
| apps/oxlint/test/isSpaceBetween.test.ts | Updates imports to pull spacing helpers from tokens_methods.ts. |
8d4fb15 to
0501477
Compare
f54116a to
2adbf6e
Compare
Member
Author
Merge activity
|
…hods (#19981) Pure refactor. `tokens.ts` was getting too large. Split it into 2 files: * `tokens.ts`: Tokens lifecycle methods - initialization, deserialization, and reset. * `tokens_methods.ts`: Public methods on `SourceCode` e.g. `sourceCode.getFirstToken`.
0501477 to
77f1c71
Compare
2adbf6e to
5e4df80
Compare
Base automatically changed from
om/03-02-perf_linter_plugins_make_tokens_class_instances
to
main
March 3, 2026 23:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pure refactor.
tokens.tswas getting too large. Split it into 2 files:tokens.ts: Tokens lifecycle methods - initialization, deserialization, and reset.tokens_methods.ts: Public methods onSourceCodee.g.sourceCode.getFirstToken.