claude[bot]

#54107: docs: use json5 for bare object literal code blocks

Merged
Created: Sep 18, 2026, 7:22:12 PM
Merged: Sep 19, 2026, 6:04:47 PM
5 comments
Target: main

Requested by David Sanders · Slack thread

Description of Change

Before: Six code blocks in the API docs contain nothing but a bare object literal (an example return value or options object) and are tagged ```js, each preceded by an <!-- eslint-skip --> comment. Four more blocks in the menus tutorial contain nothing but a bare array literal (menu templates, one of them inside a [!TIP] blockquote) and are also tagged ```js.

After: All ten blocks are tagged ```json5 and the <!-- eslint-skip --> comments are removed.

Why: the blocks are bare object and array literals, which are valid JSON5, and tagging them js doesn't play nicely with @electron/lint-roller. As JavaScript, { key: value, ... } on its own is a block statement rather than an object, so standard reports Parsing error: Unexpected token : on four of the six object blocks (the other two only parse because filters: is read as a label). They lint today only because lint-roller's lint-roller-markdown-standard and lint-roller-markdown-ts-check special-case them with a regex (wrapOrphanObjectInParens, inherited from standard-markdown) that wraps orphan {...} and [...] blocks in parentheses before linting, and disable no-labels/no-lone-blocks/no-unused-expressions to let that pass. Nothing in the current tooling honors <!-- eslint-skip -->, so those comments were dead. A companion website PR adds json5 to the site's Prism additional languages so the blocks keep highlighting.

How: fence tag changed from js to json5 and the preceding <!-- eslint-skip --> line dropped for the object literal blocks in docs/api/app.md (getGPUInfo basic response), docs/api/dialog.md (two filters examples), docs/api/structures/printer-info.md, docs/api/structures/trace-config.md, and docs/api/web-frame.md (getResourceUsage result); fence tag changed from js to json5 for the four menu template array blocks in docs/tutorial/menus.md (the three ordering examples and the adjacent-radio example in the [!TIP] blockquote). Each block was verified to parse with JSON5.parse. lint:js-in-markdown, lint:markdown, lint:ts-check-js-in-markdown, and lint:docs-relative-links pass before and after.

Checklist

Release Notes

Notes: none

🤖 Generated with Claude Code

https://claude.ai/code/session_01NBwKFgaRoEHjxoyGFpU6Ck

Backports

42-x-y
In-flight
PR Number
#54160
Waiting to be merged
43-x-y
Merged
PR Number
#54121
Merged At
Sep 19, 2026, 6:16:58 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#54120
Merged At
Sep 19, 2026, 6:16:56 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#54122
Merged At
Sep 19, 2026, 6:17:01 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron