Skip to content

Commit

Permalink
fixed possible throw with invalid tag location
Browse files Browse the repository at this point in the history
Fixes #86
  • Loading branch information
Alexej Yaroshevich committed Mar 11, 2015
1 parent 55b463e commit c56322a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/validate-jsdoc/require-param-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module.exports.options = {
function validateParamTag(node, tag, err) {
// checking existance
if (!tag.type) {
return err('missing param type');
return err('Missing param type', (tag.name ? tag.name.loc : null) || tag.loc);
}
}
14 changes: 14 additions & 0 deletions test/lib/rules/validate-jsdoc/require-param-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ describe('lib/rules/validate-jsdoc/require-param-types', function () {
}
};
}
}, {
// #86
it: 'should report with right location',
code: function () {
Cls.prototype = {
/**
* @param {} xxx
*/
run: function(xxx) {
// dummy
}
};
},
errors: {column: 17, line: 3}
}
/* jshint ignore:end */
]);
Expand Down

0 comments on commit c56322a

Please sign in to comment.