denoland/deno

`deno doc` assigns doc with `@module` tag to multiple symbols

Opened this issue · 0 comments

Version: Deno 2.5.1 (reproes since 1.0.0)

Description

A module doc tagged with @module is assigned to both the module and the first symbol in the file if the first symbol is undocumented. Expecting the first symbol to be left undocumented.

Example (bug.js)

/**
 * This is the module doc.
 *
 * @module
 */

export function foo() {}

/** This is the bar function. */
export function bar() {}

deno doc behavior

deno doc bug.js
Defined in file:///workspaces/deno-bug/bug.js:1:1

  This is the module doc.

  @module

Defined in file:///workspaces/deno-bug/bug.js:10:1

function bar(): void
  This is the bar function.

Defined in file:///workspaces/deno-bug/bug.js:7:1

function foo(): void
  This is the module doc.

  @module

deno doc --lint should fail, but it does not:

deno doc --lint bug.js
Checked 1 file

jsdoc behavior

jsdoc --version
JSDoc 4.0.4 (Sat, 19 Oct 2024 19:05:34 GMT)
jsdoc --explain bug.js | jq '.[] | select(.description != null) | {name,kind,description}'
{
  "name": "bug",
  "kind": "module",
  "description": "This is the module doc."
}
{
  "name": "bar",
  "kind": "function",
  "description": "This is the bar function."
}