Skip to content

Commit

Permalink
feat: make require-returns-description accept void functions (fixes #157
Browse files Browse the repository at this point in the history
)
  • Loading branch information
john committed Mar 13, 2019
1 parent af5a9a9 commit 75d51dc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rules/requireReturnsDescription.js
Expand Up @@ -13,6 +13,12 @@ export default iterateJsdoc(({
});

_.forEach(jsdocTags, (jsdocTag) => {
const type = jsdocTag.type && jsdocTag.type.trim();

if (type === 'void' || type === 'undefined') {
return;
}

if (!jsdocTag.description) {
report('Missing JSDoc @' + targetTagName + ' description.', null, jsdocTag);
}
Expand Down
20 changes: 20 additions & 0 deletions test/rules/assertions/requireReturnsDescription.js
Expand Up @@ -58,6 +58,26 @@ export default {
*/
function quux () {
}
`
},
{
code: `
/**
* @returns {undefined}
*/
function quux () {
}
`
},
{
code: `
/**
* @returns {void}
*/
function quux () {
}
`
}
Expand Down

0 comments on commit 75d51dc

Please sign in to comment.