Expected behavior
Do not report require-throws when a throw is added in an async function (because the function returns a rejected promise).
Actual behavior
If an async function contains a throw, ESLint report require-throws rule:
/home/regseb/testcase/index.js
1:1 error Missing JSDoc @throws declaration jsdoc/require-throws
✖ 1 problem (1 error, 0 warnings)
ESLint Config
{
"plugins": ["jsdoc"],
"parserOptions": {
"ecmaVersion": 2017
},
"rules": {
"jsdoc/require-throws": 2
}
}
ESLint sample
/**
*/
async function foo() {
throw Error("bar");
}
Environment
- Node version: 14.16.1
- ESLint version: 7.25.0
eslint-plugin-jsdoc version: 33.0.0
Expected behavior
Do not report
require-throwswhen athrowis added in anasyncfunction (because the function returns a rejected promise).Actual behavior
If an
asyncfunction contains athrow, ESLint reportrequire-throwsrule:ESLint Config
{ "plugins": ["jsdoc"], "parserOptions": { "ecmaVersion": 2017 }, "rules": { "jsdoc/require-throws": 2 } }ESLint sample
Environment
eslint-plugin-jsdocversion: 33.0.0