Skip to content

docs: fix two syntax errors in JSDoc @example blocks#2536

Merged
abetomo merged 1 commit into
tj:developfrom
patrickwehbe:fix/jsdoc-example-syntax-errors
Jun 20, 2026
Merged

docs: fix two syntax errors in JSDoc @example blocks#2536
abetomo merged 1 commit into
tj:developfrom
patrickwehbe:fix/jsdoc-example-syntax-errors

Conversation

@patrickwehbe

Copy link
Copy Markdown

Problem

Two of the JSDoc @example snippets in lib/command.js are not valid JavaScript, so anyone copying them to try out the API hits a syntax error.

commandsGroup() example (was missing the closing quote, unterminated string):

program.commandsGroup('Development Commands:);

helpOption() example (was missing the comma between the two arguments):

program.helpOption('-?, --help' 'show help'); // customise

Both throw when run as-is. Checking each snippet with node --check:

SyntaxError: Invalid or unexpected token        // commandsGroup example
SyntaxError: missing ) after argument list      // helpOption example

Solution

Add the missing closing quote and the missing comma so both examples match the documented signatures and parse cleanly:

program.commandsGroup('Development Commands:');
program.helpOption('-?, --help', 'show help'); // customise

After the change, each snippet passes node --check, and npm test (lint, unit tests, and type checks) is green.

ChangeLog

Fixed two invalid JavaScript snippets in the JSDoc examples for .commandsGroup() and .helpOption().

The @example for commandsGroup() had an unterminated string literal
(missing closing quote), and the @example for helpOption() was missing
the comma between the flags and description arguments. Both snippets
throw a SyntaxError if copied and run as-is.

@shadowspawn shadowspawn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abetomo abetomo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@abetomo abetomo merged commit 225abe3 into tj:develop Jun 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants