Skip to content

docs: add full JSDoc to createDemoLayout#388

Merged
ormidales merged 3 commits into1.1.16from
copilot/add-jsdoc-to-create-demo-layout
Mar 26, 2026
Merged

docs: add full JSDoc to createDemoLayout#388
ormidales merged 3 commits into1.1.16from
copilot/add-jsdoc-to-create-demo-layout

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

createDemoLayout — called by every demo scene — had only a bare one-liner JSDoc with no @param or @returns documentation, leaving its signature opaque for contributors.

Changes

  • src/demoLayout.ts — expanded the JSDoc block to document both parameters and the DemoLayout return value:
/**
 * Build the shared DOM structure used by demo scenes.
 *
 * Clears `document.body`, injects a top bar with a back link and title,
 * a canvas container, and a performance panel with a live FPS counter.
 *
 * @param title    Text displayed in the top bar heading.
 * @param controls Optional list of control hint strings rendered below the
 *                 FPS counter in the performance panel.
 * @returns        References to the key DOM nodes created by this function.
 */
export function createDemoLayout(title: string, controls: string[] = []): DemoLayout {  }
  • tests/demo-layout.test.ts — added an assertion that @param title, @param controls, and @returns are present in the source, consistent with the existing JSDoc-contract test pattern used across the repo.
Original prompt

This section details on the original issue you should resolve

<issue_title>[PATCH] createDemoLayout exported function is missing a JSDoc comment</issue_title>
<issue_description>Category: documentation
Severity: patch
File(s): src/demoLayout.ts (l.11)

Description

createDemoLayout is a public, exported function that builds the shared DOM structure used by every demo scene. It has no JSDoc comment: its parameters (title, controls) are undocumented, and the shape of the returned DemoLayout object is not described at the call site. Every demo file calls it, so missing documentation affects onboarding for all demo contributors.

Problematic code example

export function createDemoLayout(title: string, controls: string[] = []): DemoLayout {
  // … 40+ lines of DOM construction …
}

Suggested fix

Add a JSDoc block documenting the parameters and return value.

/**
 * Build the shared DOM structure used by demo scenes.
 *
 * Clears `document.body`, injects a top bar with a back link and title,
 * a canvas container, and a performance panel with a live FPS counter.
 *
 * @param title    Text displayed in the top bar heading.
 * @param controls Optional list of control hint strings rendered below the
 *                 FPS counter in the performance panel.
 * @returns        References to the key DOM nodes created by this function.
 */
export function createDemoLayout(title: string, controls: string[] = []): DemoLayout { /* … */ }

Acceptance criteria

  • createDemoLayout has a JSDoc block with @param tags for title and controls
  • The @returns tag describes the DemoLayout shape</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add JSDoc comment to createDemoLayout function docs: add full JSDoc to createDemoLayout Mar 26, 2026
Copilot AI requested a review from ormidales March 26, 2026 11:07
@ormidales ormidales added this to the v1.1.16 milestone Mar 26, 2026
@ormidales ormidales linked an issue Mar 26, 2026 that may be closed by this pull request
2 tasks
@ormidales ormidales marked this pull request as ready for review March 26, 2026 11:13
Copilot AI review requested due to automatic review settings March 26, 2026 11:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves contributor-facing documentation for the shared demo DOM helper createDemoLayout (used by all demo scenes) and adds a test to enforce presence of key JSDoc tags, consistent with the repo’s “JSDoc-contract via source assertions” approach.

Changes:

  • Expanded createDemoLayout JSDoc to document parameters and return value.
  • Added a Vitest assertion ensuring @param title, @param controls, and @returns exist in src/demoLayout.ts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/demoLayout.ts Adds full JSDoc block describing behavior, params, and return value for createDemoLayout.
tests/demo-layout.test.ts Adds a contract-style test asserting JSDoc tags are present in the layout source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/demo-layout.test.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ormidales ormidales merged commit e346549 into 1.1.16 Mar 26, 2026
2 checks passed
@ormidales ormidales deleted the copilot/add-jsdoc-to-create-demo-layout branch March 26, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PATCH] createDemoLayout exported function is missing a JSDoc comment

3 participants