Skip to content

Commit 6664d20

Browse files
committed
testing(require-description, require-example, require-param, require-returns): Add exemptedBy tests that nevertheless fail
1 parent 2df43ce commit 6664d20

File tree

5 files changed

+114
-0
lines changed

5 files changed

+114
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4578,6 +4578,14 @@ function quux () {
45784578
// Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
45794579
// Options: [{"descriptionStyle":"any"}]
45804580
// Message: Missing JSDoc block description or @description declaration.
4581+
4582+
/**
4583+
*
4584+
*/
4585+
function quux () {
4586+
}
4587+
// Options: [{"exemptedBy":["notPresent"]}]
4588+
// Message: Missing JSDoc block description.
45814589
````
45824590

45834591
The following patterns are not considered problems:
@@ -4801,6 +4809,14 @@ class quux {
48014809
}
48024810
// Options: [{"contexts":["ClassDeclaration"]}]
48034811
// Message: Missing JSDoc @example declaration.
4812+
4813+
/**
4814+
*
4815+
*/
4816+
function quux () {
4817+
}
4818+
// Options: [{"exemptedBy":["notPresent"]}]
4819+
// Message: Missing JSDoc @example declaration.
48044820
````
48054821

48064822
The following patterns are not considered problems:
@@ -6398,6 +6414,14 @@ function quux (foo, {bar, baz}) {
63986414
function quux ([bar, baz], foo) {
63996415
}
64006416
// Message: Missing JSDoc @param "foo" declaration.
6417+
6418+
/**
6419+
*
6420+
*/
6421+
function quux (foo) {
6422+
}
6423+
// Options: [{"exemptedBy":["notPresent"]}]
6424+
// Message: Missing JSDoc @param "foo" declaration.
64016425
````
64026426

64036427
The following patterns are not considered problems:
@@ -7403,6 +7427,15 @@ function quux () {
74037427
}
74047428
// Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
74057429
// Message: Unexpected tag `@returns`
7430+
7431+
/**
7432+
* @param foo
7433+
*/
7434+
function quux (foo) {
7435+
return 'bar';
7436+
}
7437+
// Options: [{"exemptedBy":["notPresent"]}]
7438+
// Message: Missing JSDoc @returns declaration.
74067439
````
74077440

74087441
The following patterns are not considered problems:

test/rules/assertions/requireDescription.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,26 @@ export default {
297297
},
298298
},
299299
},
300+
{
301+
code: `
302+
/**
303+
*
304+
*/
305+
function quux () {
306+
}
307+
`,
308+
errors: [
309+
{
310+
line: 2,
311+
message: 'Missing JSDoc block description.',
312+
},
313+
],
314+
options: [
315+
{
316+
exemptedBy: ['notPresent'],
317+
},
318+
],
319+
},
300320
],
301321
valid: [
302322
{

test/rules/assertions/requireExample.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,26 @@ export default {
112112
},
113113
],
114114
},
115+
{
116+
code: `
117+
/**
118+
*
119+
*/
120+
function quux () {
121+
}
122+
`,
123+
errors: [
124+
{
125+
line: 2,
126+
message: 'Missing JSDoc @example declaration.',
127+
},
128+
],
129+
options: [
130+
{
131+
exemptedBy: ['notPresent'],
132+
},
133+
],
134+
},
115135
],
116136
valid: [
117137
{

test/rules/assertions/requireParam.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,26 @@ export default {
472472
}
473473
`,
474474
},
475+
{
476+
code: `
477+
/**
478+
*
479+
*/
480+
function quux (foo) {
481+
}
482+
`,
483+
errors: [
484+
{
485+
line: 2,
486+
message: 'Missing JSDoc @param "foo" declaration.',
487+
},
488+
],
489+
options: [
490+
{
491+
exemptedBy: ['notPresent'],
492+
},
493+
],
494+
},
475495
],
476496
valid: [
477497
{

test/rules/assertions/requireReturns.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,27 @@ export default {
286286
},
287287
},
288288
},
289+
{
290+
code: `
291+
/**
292+
* @param foo
293+
*/
294+
function quux (foo) {
295+
return 'bar';
296+
}
297+
`,
298+
errors: [
299+
{
300+
line: 2,
301+
message: 'Missing JSDoc @returns declaration.',
302+
},
303+
],
304+
options: [
305+
{
306+
exemptedBy: ['notPresent'],
307+
},
308+
],
309+
},
289310
],
290311
valid: [
291312
{

0 commit comments

Comments
 (0)