Skip to content

Commit e705052

Browse files
committed
Merge pull request #38 from zxqfox/hotfix/missing-jsdoc-bugs
bugs with missing jsdoc blocks
2 parents f5182b6 + 5cf667c commit e705052

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

lib/rules/validate-jsdoc/check-param-names.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ module.exports.options = {
1010
* @param {Function} err
1111
*/
1212
function validateCheckParamNames(node, err) {
13+
if (!node.jsdoc) {
14+
return;
15+
}
16+
1317
node.jsdoc.iterateByType(['param', 'arg', 'argument'],
1418
/**
1519
* tag checker

lib/rules/validate-jsdoc/check-redundant-params.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ module.exports.options = {
1010
* @param {Function} err
1111
*/
1212
function validateCheckParamNames(node, err) {
13+
if (!node.jsdoc) {
14+
return;
15+
}
16+
1317
node.jsdoc.iterateByType(['param', 'arg', 'argument'],
1418
/**
1519
* tag checker
@@ -18,7 +22,7 @@ function validateCheckParamNames(node, err) {
1822
*/
1923
function(tag, i) {
2024
// skip if there is dot in param name (object's inner param)
21-
if (tag.name.value.indexOf('.') !== -1) {
25+
if (tag.name && tag.name.value.indexOf('.') !== -1) {
2226
return;
2327
}
2428

test/lib/rules/validate-jsdoc/check-param-names.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ describe('rules/validate-jsdoc', function () {
99
checker.cases([
1010
/* jshint ignore:start */
1111
{
12+
it: 'should not throw',
13+
code: function() {
14+
function yay(yey) {
15+
}
16+
}
17+
18+
}, {
1219
it: 'should report invalid jsdoc',
1320
code: function () {
1421
var x = 1;

test/lib/rules/validate-jsdoc/check-redundant-params.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ describe('rules/validate-jsdoc', function () {
99
checker.cases([
1010
/* jshint ignore:start */
1111
{
12+
it: 'should not throw',
13+
code: function() {
14+
function yay(yey) {
15+
}
16+
}
17+
18+
}, {
1219
it: 'should report redundant jsdoc-param for function',
1320
errors: 1,
1421
code: function () {

0 commit comments

Comments
 (0)