fix: improve parse error display format#637
Open
bartlomieju wants to merge 5 commits intodenoland:mainfrom
Open
fix: improve parse error display format#637bartlomieju wants to merge 5 commits intodenoland:mainfrom
bartlomieju wants to merge 5 commits intodenoland:mainfrom
Conversation
Reformats syntax error messages to use a structured format with
location on its own line, pipe margins, line numbers, and carets
instead of the previous flat single-line format.
Before:
The module's source code could not be parsed: Expected ',' got 'x' at file:///a.js:1:13
import from "./foo.js"
~~~~~~~~~~
After:
Expected ',' got 'x'
at file:///a.js:1:13
|
1 | import from "./foo.js"
| ~~~~~~~~~~
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
dsherret
reviewed
Mar 12, 2026
Member
dsherret
left a comment
There was a problem hiding this comment.
Can you do a ci run with this in the deno repo before merging?
Member
Author
|
Yeah, I opened denoland/deno#32669, but I'm not yet happy with the output |
- Location line now appears after the code snippet instead of before
- String literal token descriptions simplified (e.g. 'string literal ("./foo.js", "./foo.js")' -> "./foo.js")
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
ModuleErrorKind::Parseto use a structured format with location on its own line, pipe margins, line numbers, and caretsBefore:
After:
Test plan
tests/specs/graph/cjs/file_export.txtjs/test.ts🤖 Generated with Claude Code