Skip to content

Commit 149316b

Browse files
author
Alexej Yaroshevich
committed
Merge branch 'hotfix/fixup-constructor-bug'
2 parents 83cfd9a + 51d5cbb commit 149316b

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

lib/rules/validate-jsdoc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ module.exports.prototype = {
4141
assert(v.length === 3, 'jsDoc rules: Wrong arity in ' + v._name + ' validator');
4242
rulesForTags[scope] = rulesForTags[scope] || {};
4343
v.tags.forEach(function(tag) {
44-
rulesForTags[scope][tag] = rulesForTags[scope][tag] || [];
45-
rulesForTags[scope][tag].push(v);
44+
var dtag = '@' + tag;
45+
rulesForTags[scope][dtag] = rulesForTags[scope][dtag] || [];
46+
rulesForTags[scope][dtag].push(v);
4647
});
4748
});
4849
}, this);
@@ -104,12 +105,12 @@ module.exports.prototype = {
104105

105106
// call rule checkers
106107
node.jsdoc.iterate(function(tag, i) {
107-
if (!validators[tag.id]) {
108+
if (!validators['@' + tag.id]) {
108109
return;
109110
}
110111
// call tag validator
111112
commentStart.line = commentStartLine + i;
112-
validators[tag.id].forEach(function(v) {
113+
validators['@' + tag.id].forEach(function(v) {
113114
v.call(_this, node, tag, fixErrLocation(addError, tag));
114115
});
115116
});

test/lib/rules/validate-jsdoc.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var assert = require('assert');
22

3-
describe('rules/validate-jsdoc', function () {
3+
describe('lib/rules/validate-jsdoc', function () {
44
var checker = global.checker({
55
additionalRules: ['lib/rules/validate-jsdoc.js']
66
});
@@ -32,4 +32,30 @@ describe('rules/validate-jsdoc', function () {
3232
});
3333

3434
});
35+
36+
describe('additional checks', function () {
37+
38+
checker.cases([
39+
/* jshint ignore:start */
40+
{
41+
it: 'should not throw anyway',
42+
rules: {checkReturnTypes: true},
43+
code: function() {
44+
/**
45+
* Cacher object
46+
* @constructor
47+
* @param {Object} o
48+
* @param {Object} [o.storage={}] initial storage for cache
49+
* @param {Number} [o.expTime=300] expiration time in seconds. 5 min by default
50+
*/
51+
function Cacher (o) {
52+
// doesn't mean
53+
}
54+
}
55+
}
56+
/* jshint ignore:end */
57+
]);
58+
59+
});
60+
3561
});

0 commit comments

Comments
 (0)