deno icon indicating copy to clipboard operation
deno copied to clipboard

`deno doc --lint` says no return type annotation error for JS code

Open aKuad opened this issue 7 months ago • 0 comments

A JS code for a function with @returns JSDoc below:

any_mod.js

/**
 * Module description here
 *
 * @module
 */

/**
 * Function description here
 *
 * @returns {number} Return value description
 */
export function any_func() {
  return 0;
}

Then doc lint it:

deno doc --lint *.js

The linter returns the error:

error[missing-return-type]: exported function is missing an explicit return type annotation
  --> /home/akuad/work/any_mod.js:12:1
   | 
12 | export function any_func() {
   | ^


error: Found 1 documentation lint error.

It says 'missing an explicit return type annotation', but type annotation is for TS, not for JS.

I suggest to be skipped the 'missing-return-type' error for JS functions what having @return/@returns JSDoc.

Or is this linter for TS only, not for JS?


Add (12/02/2025): It occurs at Deno version 2.5.4

aKuad avatar Aug 01 '25 13:08 aKuad