Skip to content

Commit

Permalink
checkReturnTypes: skip checking 'this.something'
Browse files Browse the repository at this point in the history
Fixes #115
  • Loading branch information
Alexej Yaroshevich committed Jul 1, 2015
1 parent 80c3ea7 commit 41b5b7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/jsdoc.js
Expand Up @@ -519,12 +519,16 @@ function jsDocMatchType (variants, argument) {
result = result || (type === 'array');

} else if (argument.type === 'NewExpression' && type === 'object') {
result = result || true;
result = true;

} else if (argument.type === 'NewExpression') {
var c = argument.callee;
var exam = c.name;
if (!exam && c.type === 'MemberExpression') {
if (c.object.type === 'ThisExpression') {
result = true;
break;
}
var cur = c;
exam = [];
while (cur.object) {
Expand Down
10 changes: 10 additions & 0 deletions test/lib/rules/validate-jsdoc/check-return-types.js
Expand Up @@ -291,6 +291,16 @@ describe('lib/rules/validate-jsdoc/check-return-types', function () {
};
};
}
}, {
it: 'should not report on `@returns {Class}` for `new this.*`. issue #115',
code: function () {
/**
* @returns {Element}
*/
function foo() {
return new this.something();
}
}
}
/* jshint ignore:end */
]);
Expand Down

0 comments on commit 41b5b7b

Please sign in to comment.