Skip to content

docs(jsonc): document the accepted JSONC dialect and the TypeError from new - #7301

Open
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:docs-jsonc-parse-docs
Open

docs(jsonc): document the accepted JSONC dialect and the TypeError from new#7301
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:docs-jsonc-parse-docs

Conversation

@tomas-zijdemans

Copy link
Copy Markdown
Contributor

Documents what @std/jsonc accepts. Doc comments only, no behavior change.

The module doc linked to the VS Code JSONC page and left it at that, so the dialect was never stated in std's own docs. That got worse when allowTrailingComma was removed in #5119: trailing commas became unconditional, and nothing said so. Both jsonc/mod.ts and parse() now spell out the three additions over JSON (line comments, block comments, trailing comma after the last member) and note that comments are discarded.

parse() also gains a @throws line for the TypeError it raises when called with new. The new.target guard is there in the code and covered by a test in parse_test.ts, but only SyntaxError was documented.

One thing I left alone. CONTRIBUTING.md says @param/@returns come before @example, and jsonc does the opposite. So does most of the repo: 478 doc blocks put @example first against 335 that don't, and sibling yaml/parse.ts uses the same layout as jsonc. Reordering one module would be churn, not a fix.

deno fmt, deno lint, deno task lint:docs, and the jsonc suite (408 tests) all pass.

I used Claude Code to help investigate and write this change.

@github-actions github-actions Bot added the jsonc label Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (ca58f94) to head (73bf054).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7301   +/-   ##
=======================================
  Coverage   95.03%   95.03%           
=======================================
  Files         617      617           
  Lines       51637    51637           
  Branches     9359     9359           
=======================================
  Hits        49075    49075           
  Misses       2021     2021           
  Partials      541      541           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant