-
-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Description
Expected behavior
jsdoc/require-returns should not emit a warning because the return type is Promise<void>.
Actual behavior
1:1 warning Missing JSDoc @returns declaration jsdoc/require-returns.
Happens even if the function is declared async explicitly. Without the <void>, the return type is inferred to be Promise<unknown> in which case the warning makes sense. Is this type knowledge lost to jsdoc in this case?
ESLint Config
{
"root": true,
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended"
],
"env": {
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"jsdoc/no-types": "warn",
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-type": 0
},
"plugins": ["@typescript-eslint", "jsdoc"]
}
ESLint sample
/**
* @param ms time in millis
*/
export const sleep = (ms: number) =>
new Promise<void>((res) => setTimeout(res, ms));The warning can be fixed by adding @returns nothing to the jsdoc above.
Environment
- Node version:
14.18.1 - ESLint version:
8.10.0 eslint-plugin-jsdocversion:37.9.4