Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-returns-check doesn't handle * types correctly #950

Closed
noahtallen opened this issue Jan 19, 2023 · 1 comment · Fixed by #951 or #952
Closed

require-returns-check doesn't handle * types correctly #950

noahtallen opened this issue Jan 19, 2023 · 1 comment · Fixed by #951 or #952

Comments

@noahtallen
Copy link

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-jsdoc version: 39.6.6 (latest)
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 20, 2023
…any` types to avoid reporting of missing return; fixes gajus#950
brettz9 added a commit that referenced this issue Jan 20, 2023
…any` types to avoid reporting of missing return; fixes #950
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 20, 2023
…*` and `any` types to avoid reporting of missing return; fixes gajus#950"

This reverts commit 496904b.
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Jan 20, 2023
…any` types to avoid reporting of missing return; fixes gajus#950
brettz9 added a commit that referenced this issue Jan 20, 2023
…*` and `any` types to avoid reporting of missing return; fixes #950"

This reverts commit 496904b.
brettz9 added a commit that referenced this issue Jan 20, 2023
…any` types to avoid reporting of missing return; fixes #950
@github-actions
Copy link

🎉 This issue has been resolved in version 39.6.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants