fix(json-formatter): auto fix destroys text in single-quoted strings #31
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
flopana/OpenDevTools#31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #30
Branch:
feature/improve-json-formatterBugs
Auto fix in
src/lib/jsonFixer.tsreads"strings only.JsonFormatterComponent.tsxwrites the result back into the input, so bug 1 destroys user text.{'url': 'http://example.com'}{"url": 'http:(the rest is gone){'a': 'say "hi"'}{"a": 'say "hi"'}(invalid){'a': 'it\'s'}{"a": "it\"s'}(invalid){"a": 1 // say "x+ newline +}{"a": 1 "x+ newline +}(invalid)Verification: the review agent reproduced all 4 in node.
Red tests
Add the 4 inputs to
src/lib/jsonFixer.test.ts. Expected: valid JSON with no data loss.Fix
Replace the passes with one scanner. It reads
"strings,'strings with escapes,//comments and/* */comments in one pass. It changes only text outside strings. The existing tests stay green.Also in scope
trim()in both checks.