@@ -146,7 +146,7 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
146
146
} ,
147
147
errors : [
148
148
{
149
- message : 'parameters xxx and yyy are out of order' ,
149
+ message : 'Parameters xxx and yyy are out of order' ,
150
150
column : 10 ,
151
151
line : 2 ,
152
152
rule : "jsDoc" ,
@@ -168,14 +168,14 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
168
168
} ,
169
169
errors : [
170
170
{
171
- message : 'parameters xxx and zzz are out of order' ,
171
+ message : 'Parameters xxx and zzz are out of order' ,
172
172
column : 14 ,
173
173
line : 3 ,
174
174
rule : "jsDoc" ,
175
175
filename : "input"
176
176
} ,
177
177
{
178
- message : 'parameters yyy and xxx are out of order' ,
178
+ message : 'Parameters yyy and xxx are out of order' ,
179
179
column : 14 ,
180
180
line : 4 ,
181
181
rule : "jsDoc" ,
@@ -195,8 +195,8 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
195
195
} ;
196
196
} ,
197
197
errors : [
198
- { message : 'parameter xxx is out of order' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
199
- { message : 'expected xxx but got yyy' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
198
+ { message : 'Parameter xxx is out of order' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
199
+ { message : 'Expected xxx but got yyy' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
200
200
]
201
201
} , {
202
202
it : 'should report out of order and expected v2' ,
@@ -211,8 +211,8 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
211
211
} ;
212
212
} ,
213
213
errors : [
214
- { message : 'expected yyy but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
215
- { message : 'parameter yyy is out of order' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
214
+ { message : 'Expected yyy but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" } ,
215
+ { message : 'Parameter yyy is out of order' , column : 14 , line : 4 , rule : "jsDoc" , filename : "input" }
216
216
]
217
217
} , {
218
218
it : 'should not report out of order but expected' ,
@@ -227,10 +227,27 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
227
227
} ;
228
228
} ,
229
229
errors : [
230
- { message : 'expected zzz but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" }
230
+ { message : 'Expected zzz but got xxx' , column : 14 , line : 3 , rule : "jsDoc" , filename : "input" }
231
231
]
232
-
233
232
} , {
233
+ it : 'should not report wrong order' ,
234
+ code : function ( ) {
235
+ /**
236
+ * @param {string|Array.<string> } types
237
+ * @param {function(this: DocComment, DocTag): DocComment } fn
238
+ */
239
+ function iterateByTypes ( types , fn ) { }
240
+ }
241
+ }
242
+ // jscs:enable
243
+ /* jshint ignore:end */
244
+ ] ) ;
245
+
246
+ // ticked and chevroned param names
247
+ checker . cases ( [
248
+ /* jshint ignore:start */
249
+ /* jscs:disable */
250
+ {
234
251
it : 'should not report simple ticked param' ,
235
252
code : function ( ) {
236
253
/**
@@ -256,7 +273,16 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
256
273
*/
257
274
function methodThree ( required , optional ) { }
258
275
}
259
- } , {
276
+ }
277
+ // jscs:enable
278
+ /* jshint ignore:end */
279
+ ] ) ;
280
+
281
+ // dotted param names
282
+ checker . cases ( [
283
+ /* jshint ignore:start */
284
+ /* jscs:disable */
285
+ {
260
286
it : 'should not report dotted param names' ,
261
287
code : function ( ) {
262
288
/**
@@ -270,14 +296,50 @@ describe('lib/rules/validate-jsdoc/check-param-names', function() {
270
296
function yeah ( mod , props , staticProps ) { }
271
297
}
272
298
} , {
273
- it : 'should not report wrong order ' ,
299
+ it : 'should report inconsistency of separated dotted params ' ,
274
300
code : function ( ) {
275
301
/**
276
- * @param {string|Array.<string> } types
277
- * @param {function(this: DocComment, DocTag): DocComment } fn
302
+ * @param {Object } options
303
+ * @param {String } definetelyNotOptions.cdir
304
+ * @param {Boolean } otherOptions.noLog
278
305
*/
279
- function iterateByTypes ( types , fn ) { }
280
- }
306
+ module . exports . createMiddleware = function ( options ) { /* ... */ } ;
307
+ } ,
308
+ errors : [
309
+ {
310
+ "column" : 19 ,
311
+ "filename" : "input" ,
312
+ "line" : 3 ,
313
+ "message" : "Expected `options` but got `definetelyNotOptions`" ,
314
+ "rule" : "jsDoc"
315
+ } ,
316
+ {
317
+ "column" : 20 ,
318
+ "filename" : "input" ,
319
+ "line" : 4 ,
320
+ "message" : "Expected `options` but got `otherOptions`" ,
321
+ "rule" : "jsDoc"
322
+ }
323
+ ]
324
+ } , {
325
+ it : 'should report unjoined params' ,
326
+ code : function ( ) {
327
+ /**
328
+ * @param {String } options.cdir
329
+ */
330
+ module . exports . createMiddleware = function ( ) { /* ... */ } ;
331
+ } ,
332
+ errors : { "message" : "Inconsistent param found" }
333
+ } , {
334
+ it : 'should not report params' ,
335
+ code : function ( ) {
336
+ /**
337
+ * @param {Object } options
338
+ * @param {String } options.cdir
339
+ */
340
+ module . exports . createMiddleware = function ( ) { /* ... */ } ;
341
+ } ,
342
+ errors : [ ]
281
343
}
282
344
/* jscs: enable */
283
345
/* jshint ignore:end */
0 commit comments