Skip to content

Commit af5a9a9

Browse files
authored
fix: requireReturns Rule does not honor inheritdoc tag (fixes #153)
RequireReturns Rule does not honor inheritdoc tag.
2 parents 9b185d8 + 5edb2e1 commit af5a9a9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/rules/requireReturns.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ export default iterateJsdoc(({
66
report,
77
utils
88
}) => {
9+
// inheritdoc implies that all documentation is inherited
10+
// see http://usejsdoc.org/tags-inheritdoc.html
11+
//
12+
// As we do not know the parent method, we cannot perform any checks.
13+
if (utils.hasTag('inheritdoc')) {
14+
return;
15+
}
16+
917
const targetTagName = utils.getPreferredTagName('returns');
1018

1119
const jsdocTags = _.filter(jsdoc.tags, {

test/rules/assertions/requireReturns.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ export default {
138138
*/
139139
const quux = (bar) => bar.filter(({ corge }) => corge())
140140
`
141+
},
142+
{
143+
code: `
144+
/**
145+
* @inheritdoc
146+
*/
147+
function quux (foo) {
148+
return "test"
149+
}
150+
`
141151
}
142152
]
143153
};

0 commit comments

Comments
 (0)