fix(linter/plugins): include loc when call JSON.stringify on Tokens and Comments#20512
Merged
graphite-app[bot] merged 1 commit intomainfrom Mar 21, 2026
Conversation
This was referenced Mar 19, 2026
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures loc is included when JSON.stringify is called on runtime Token and Comment instances (where loc is implemented as a prototype getter), and updates fixture-based snapshot coverage accordingly.
Changes:
- Add
toJSON()toTokenandCommentsoJSON.stringifyincludesloc. - Extend the tokens/comments fixture plugins to report a
JSON.stringifyrendering for the first token/comment. - Update snapshot outputs to reflect the new serialized shape (including
loc) and updated error counts.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apps/oxlint/src-js/plugins/tokens.ts | Adds Token.toJSON() to include loc in JSON serialization. |
| apps/oxlint/src-js/plugins/comments.ts | Adds Comment.toJSON() to include loc in JSON serialization. |
| apps/oxlint/test/fixtures/tokens/plugin.ts | Fixture plugin emits JSON.stringify output for a token to validate serialization. |
| apps/oxlint/test/fixtures/tokens/output.snap.md | Snapshot updated to include token loc in JSON output and adjusted totals. |
| apps/oxlint/test/fixtures/comments/plugin.ts | Fixture plugin emits JSON.stringify output for a comment to validate serialization. |
| apps/oxlint/test/fixtures/comments/output.snap.md | Snapshot updated to include comment loc in JSON output and adjusted totals. |
Member
Author
Merge activity
|
3ac4b1e to
7b5d718
Compare
157ae2b to
3512af4
Compare
7b5d718 to
4c2b69a
Compare
3512af4 to
0216572
Compare
4c2b69a to
e233fae
Compare
0216572 to
89d4f42
Compare
89d4f42 to
ac2c37c
Compare
…en`s and `Comment`s (#20512) `loc` property of `Token`s and `Comment`s is a getter on these classes' prototypes. Add a `toJSON` method to both classes so `JSON.stringify` includes `loc` in the generated JSON.
ac2c37c to
532c921
Compare
This was referenced Mar 23, 2026
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.

locproperty ofTokens andComments is a getter on these classes' prototypes. Add atoJSONmethod to both classes soJSON.stringifyincludeslocin the generated JSON.