Skip to content

Commit dd0873e

Browse files
author
Alexej Yaroshevich
committed
enforce rule should ignore anonymous functions
1 parent 3160fbf commit dd0873e

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/rules/validate-jsdoc/enforce-existence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports.options = {
1010
* @param {Function} err
1111
*/
1212
function enforceExistence(node, err) {
13-
if (!node.jsDoc) {
13+
if (!node.jsDoc && node.id) {
1414
err('jsdoc definition required', node.loc.start);
1515
}
1616
}

test/lib/rules/validate-jsdoc/enforce-existence.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ describe('rules/validate-jsdoc', function () {
3636
function funcName(p) {
3737
}
3838
}
39+
}, {
40+
it: 'should not report jsdoc absence for anonymous functions',
41+
code: function () {
42+
[].forEach(function (v) {
43+
});
44+
}
3945
}
4046
/* jshint ignore:end */
4147
]);

0 commit comments

Comments
 (0)