Skip to content

Commit cf2aff9

Browse files
author
Alexej Yaroshevich
committed
1 parent d8bc899 commit cf2aff9

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"comment-parser": "0.3.0",
27-
"jsdoctypeparser": "1.1.4"
27+
"jsdoctypeparser": "~1.2.0"
2828
},
2929
"devDependencies": {
3030
"chai": "^2.3.0",

test/init.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ function fnBody(func) {
4040
return out;
4141
}
4242

43+
/**
44+
* @typedef {{it: string, code: Function, rules: ?Object, errors: ?*, skip: ?boolean}} TestCase
45+
*/
46+
4347
/**
4448
* Testing helper object
4549
*
4650
* @param {Object} opts default options for jscs string checker
47-
* @returns {{rules: function(Object),
48-
* configure: function(Object),
49-
* cases: function(Array.<TestCase{it: string, code: Function, ?rules: Object, ?errors: *, ?skip: boolean}>),
50-
* check: function(string)}}
51+
* @returns {{rules: function(Object), configure: function(Object),
52+
* cases: function(TestCase[]), check: function(string)}}
5153
*/
5254
function rulesChecker(opts) {
5355
var checker;
@@ -84,7 +86,7 @@ function rulesChecker(opts) {
8486
/**
8587
* Describe cases (wrapper for mocha it calls)
8688
*
87-
* @param {Array.<{it: string, code: Function, ?rules: Object, ?errors: *, ?skip: boolean}>} items
89+
* @param {TestCase[]} items
8890
*/
8991
cases: function(items) {
9092
items = items || [];

test/lib/rules/validate-jsdoc/check-types.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,25 @@ describe('lib/rules/validate-jsdoc/check-types', function() {
128128
ClsName.prototype.point = function (q, w) {
129129
}
130130
}
131-
}, {
131+
}
132+
/* jshint ignore:end *//* jscs: enable */
133+
]);
134+
});
135+
136+
describe('regressions with true', function() {
137+
checker.rules({checkTypes: true});
138+
139+
checker.cases([
140+
/* jshint ignore:start *//* jscs: disable */
141+
{
132142
it: 'should report invalid types in params and returns',
133-
errors: 3,
143+
errors: 4,
134144
code: function() {
135145
/**
136146
* @param {Obj+ect} q
137147
* @param {Num/ber} w
138-
* @return {Str~ing}
148+
* @param {Str-ing} [e]
149+
* @return {Str ing}
139150
*/
140151
ClsName.prototype.point = function (q, w) {
141152
}
@@ -155,6 +166,24 @@ describe('lib/rules/validate-jsdoc/check-types', function() {
155166
return t;
156167
}
157168
}
169+
}, {
170+
it: 'should not report modules nor minuses inside module names. issue #88',
171+
code: function () {
172+
/**
173+
* @param {?module:my_pants-on/me.Jeans#hem} foo
174+
* @param {?module: .a_B/c-d~e.f0} bar
175+
*/
176+
function baz() {}
177+
}
178+
}, {
179+
it: 'should not report 2+d arrays',
180+
code: function () {
181+
/**
182+
* @param {?obj[][]} foo
183+
* @param {?obj[][][]} bar
184+
*/
185+
function baz() {}
186+
}
158187
}
159188
/* jshint ignore:end *//* jscs: enable */
160189
]);

0 commit comments

Comments
 (0)