Skip to content

Commit

Permalink
fix(require-returns): check labeled statements
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 31, 2021
1 parent e7acd09 commit 51f37f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ const hasReturnValue = (node, promFilter) => {
return bodyNode.type !== 'FunctionDeclaration' && hasReturnValue(bodyNode, promFilter);
});
}
case 'LabeledStatement':
case 'WhileStatement':
case 'DoWhileStatement':
case 'ForStatement':
Expand Down
19 changes: 19 additions & 0 deletions test/rules/assertions/requireReturns.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ export default {
},
],
},
{
code: `
/**
*
*/
function quux (foo) {
someLabel: {
return foo;
}
}
`,
errors: [
{
line: 2,
message: 'Missing JSDoc @returns declaration.',
},
],
ignoreReadme: true,
},
{
code: `
/**
Expand Down

0 comments on commit 51f37f1

Please sign in to comment.