Skip to content

Commit

Permalink
Merge pull request #38 from zxqfox/hotfix/missing-jsdoc-bugs
Browse files Browse the repository at this point in the history
bugs with missing jsdoc blocks
  • Loading branch information
qfox committed Nov 10, 2014
2 parents f5182b6 + 5cf667c commit e705052
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/rules/validate-jsdoc/check-param-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports.options = {
* @param {Function} err
*/
function validateCheckParamNames(node, err) {
if (!node.jsdoc) {
return;
}

node.jsdoc.iterateByType(['param', 'arg', 'argument'],
/**
* tag checker
Expand Down
6 changes: 5 additions & 1 deletion lib/rules/validate-jsdoc/check-redundant-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports.options = {
* @param {Function} err
*/
function validateCheckParamNames(node, err) {
if (!node.jsdoc) {
return;
}

node.jsdoc.iterateByType(['param', 'arg', 'argument'],
/**
* tag checker
Expand All @@ -18,7 +22,7 @@ function validateCheckParamNames(node, err) {
*/
function(tag, i) {
// skip if there is dot in param name (object's inner param)
if (tag.name.value.indexOf('.') !== -1) {
if (tag.name && tag.name.value.indexOf('.') !== -1) {
return;
}

Expand Down
7 changes: 7 additions & 0 deletions test/lib/rules/validate-jsdoc/check-param-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ describe('rules/validate-jsdoc', function () {
checker.cases([
/* jshint ignore:start */
{
it: 'should not throw',
code: function() {
function yay(yey) {
}
}

}, {
it: 'should report invalid jsdoc',
code: function () {
var x = 1;
Expand Down
7 changes: 7 additions & 0 deletions test/lib/rules/validate-jsdoc/check-redundant-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ describe('rules/validate-jsdoc', function () {
checker.cases([
/* jshint ignore:start */
{
it: 'should not throw',
code: function() {
function yay(yey) {
}
}

}, {
it: 'should report redundant jsdoc-param for function',
errors: 1,
code: function () {
Expand Down

0 comments on commit e705052

Please sign in to comment.