-
-
Notifications
You must be signed in to change notification settings - Fork 169
Description
Expected behavior
I think this one might be a bug. I expect this to be ok:
/*
* @param {boolean} bar A fun variable.
* @returns {*} Anything at all!
*/
function foo( bar ) {
if ( bar ) {
return functionWithUnknownReturnType();
}
}The * type means the function can return anything, which IMO should include undefined/void/etc. This can be fixed with {*|undefined}, but that's pretty weird :P
Actual behavior
This error happens: JSDoc @returns declaration present but return expression not available in function
ESLint Config
'jsdoc/require-returns-check': 'error'ESLint sample
See above
Environment
- Node version: happens in both 16 and 18
- ESLint version: 8.14.0
eslint-plugin-jsdocversion: 39.6.6 (latest)