Skip to content

require-returns-check: warns about return in try-finally #926

@kevinoid

Description

@kevinoid

Expected behavior

jsdoc/require-returns-check should not produce a warning or error for functions with a return statement in a try-finally statement.

Actual behavior

The following warning is produced:

1:1  warning  JSDoc @returns declaration present but return expression not available in function  jsdoc/require-returns-check

ESLint Config

{
  "extends": [
    "plugin:jsdoc/recommended"
  ]
}

ESLint sample

/** Returns true.
 *
 * @returns {boolean} true
 */
function getTrue() {
  try {
    return true;
  } finally {
    console.log('returning...');
  }
}

Environment

  • Node version: v18.10.0
  • ESLint version v8.26.0
  • eslint-plugin-jsdoc version: 39.3.22

Related Issues

#924 #925

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions