Skip to content

Commit

Permalink
checkParamNames: skip dotted params (as it was initially)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexej Yaroshevich committed Dec 1, 2014
1 parent 5d24286 commit b311704
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/rules/validate-jsdoc/check-param-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function validateCheckParamNames(node, err) {
}
});
var outOfOrder = {};
var skipped = 0;

node.jsdoc.iterateByType(['param', 'arg', 'argument'],
/**
Expand All @@ -39,12 +40,17 @@ function validateCheckParamNames(node, err) {
return err('missing param name', tag.loc);
}

var param = node.params[i];
var param = node.params[i - skipped];
if (!param) {
// skip if no param
return;
}

if (tag.value.indexOf('.') !== -1) {
skipped++;
return;
}

// checking name
var msg;
if (tag.name.value !== param.name && !outOfOrder[tag.name.value]) {
Expand Down
14 changes: 14 additions & 0 deletions test/lib/rules/validate-jsdoc/check-param-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
*/
function methodThree(required, optional) {}
}
}, {
it: 'should not report dotted param names',
code: function() {
/**
* Declares modifier
* @param {Object} mod
* @param {String} mod.modName
* @param {String|Boolean|Array} [mod.modVal]
* @param {Object} props
* @param {Object} [staticProps]
* @returns {Function}
*/
function yeah(mod, props, staticProps) {}
}
}
/* jscs: enable */
/* jshint ignore:end */
Expand Down

0 comments on commit b311704

Please sign in to comment.