Skip to content

Commit 51f37f1

Browse files
committed
fix(require-returns): check labeled statements
1 parent e7acd09 commit 51f37f1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/jsdocUtils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ const hasReturnValue = (node, promFilter) => {
524524
return bodyNode.type !== 'FunctionDeclaration' && hasReturnValue(bodyNode, promFilter);
525525
});
526526
}
527+
case 'LabeledStatement':
527528
case 'WhileStatement':
528529
case 'DoWhileStatement':
529530
case 'ForStatement':

test/rules/assertions/requireReturns.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@ export default {
1717
},
1818
],
1919
},
20+
{
21+
code: `
22+
/**
23+
*
24+
*/
25+
function quux (foo) {
26+
someLabel: {
27+
return foo;
28+
}
29+
}
30+
`,
31+
errors: [
32+
{
33+
line: 2,
34+
message: 'Missing JSDoc @returns declaration.',
35+
},
36+
],
37+
ignoreReadme: true,
38+
},
2039
{
2140
code: `
2241
/**

0 commit comments

Comments
 (0)