eslint-plugin-jsdoc 46.4.5 → 46.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +31 -0
  2. package/dist/alignTransform.js +5 -5
  3. package/dist/alignTransform.js.map +1 -1
  4. package/dist/index.js +21 -10
  5. package/dist/index.js.map +1 -1
  6. package/dist/iterateJsdoc.js +1 -1
  7. package/dist/iterateJsdoc.js.map +1 -1
  8. package/dist/rules/checkExamples.js +12 -6
  9. package/dist/rules/checkExamples.js.map +1 -1
  10. package/package.json +19 -15
  11. package/docs/advanced.md +0 -102
  12. package/docs/rules/check-access.md +0 -193
  13. package/docs/rules/check-alignment.md +0 -169
  14. package/docs/rules/check-examples.md +0 -784
  15. package/docs/rules/check-indentation.md +0 -296
  16. package/docs/rules/check-line-alignment.md +0 -1002
  17. package/docs/rules/check-param-names.md +0 -1035
  18. package/docs/rules/check-property-names.md +0 -244
  19. package/docs/rules/check-syntax.md +0 -80
  20. package/docs/rules/check-tag-names.md +0 -1132
  21. package/docs/rules/check-types.md +0 -1198
  22. package/docs/rules/check-values.md +0 -409
  23. package/docs/rules/empty-tags.md +0 -220
  24. package/docs/rules/implements-on-classes.md +0 -219
  25. package/docs/rules/imports-as-dependencies.md +0 -99
  26. package/docs/rules/informative-docs.md +0 -400
  27. package/docs/rules/match-description.md +0 -1008
  28. package/docs/rules/match-name.md +0 -249
  29. package/docs/rules/multiline-blocks.md +0 -398
  30. package/docs/rules/no-bad-blocks.md +0 -174
  31. package/docs/rules/no-blank-block-descriptions.md +0 -91
  32. package/docs/rules/no-blank-blocks.md +0 -98
  33. package/docs/rules/no-defaults.md +0 -207
  34. package/docs/rules/no-missing-syntax.md +0 -275
  35. package/docs/rules/no-multi-asterisks.md +0 -278
  36. package/docs/rules/no-restricted-syntax.md +0 -383
  37. package/docs/rules/no-types.md +0 -168
  38. package/docs/rules/no-undefined-types.md +0 -789
  39. package/docs/rules/require-asterisk-prefix.md +0 -297
  40. package/docs/rules/require-description-complete-sentence.md +0 -820
  41. package/docs/rules/require-description.md +0 -585
  42. package/docs/rules/require-example.md +0 -390
  43. package/docs/rules/require-file-overview.md +0 -324
  44. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  45. package/docs/rules/require-jsdoc.md +0 -1857
  46. package/docs/rules/require-param-description.md +0 -238
  47. package/docs/rules/require-param-name.md +0 -163
  48. package/docs/rules/require-param-type.md +0 -227
  49. package/docs/rules/require-param.md +0 -1820
  50. package/docs/rules/require-property-description.md +0 -88
  51. package/docs/rules/require-property-name.md +0 -79
  52. package/docs/rules/require-property-type.md +0 -79
  53. package/docs/rules/require-property.md +0 -128
  54. package/docs/rules/require-returns-check.md +0 -1053
  55. package/docs/rules/require-returns-description.md +0 -181
  56. package/docs/rules/require-returns-type.md +0 -144
  57. package/docs/rules/require-returns.md +0 -1191
  58. package/docs/rules/require-throws.md +0 -326
  59. package/docs/rules/require-yields-check.md +0 -544
  60. package/docs/rules/require-yields.md +0 -823
  61. package/docs/rules/sort-tags.md +0 -635
  62. package/docs/rules/tag-lines.md +0 -551
  63. package/docs/rules/text-escaping.md +0 -177
  64. package/docs/rules/valid-types.md +0 -881
  65. package/docs/settings.md +0 -362
  66. package/tsconfig.json +0 -22
@@ -1,544 +0,0 @@
1
- <a name="user-content-require-yields-check"></a>
2
- <a name="require-yields-check"></a>
3
- # <code>require-yields-check</code>
4
-
5
- * [Options](#user-content-require-yields-check-options)
6
- * [Context and settings](#user-content-require-yields-check-context-and-settings)
7
- * [Failing examples](#user-content-require-yields-check-failing-examples)
8
- * [Passing examples](#user-content-require-yields-check-passing-examples)
9
-
10
-
11
- Ensures that if a `@yields` is present that a `yield` (or `yield` with a
12
- value) is present in the function body (or that if a `@next` is present that
13
- there is a `yield` with a return value present).
14
-
15
- Please also note that JavaScript does allow generators not to have `yield`
16
- (e.g., with just a return or even no explicit return), but if you want to
17
- enforce that all generators (except wholly empty ones) have a `yield` in the
18
- function body, you can use the ESLint
19
- [`require-yield`](https://eslint.org/docs/rules/require-yield) rule. In
20
- conjunction with this, you can also use the `checkGeneratorsOnly` option
21
- as an optimization so that this rule won't need to do its own checking within
22
- function bodies.
23
-
24
- Will also report if multiple `@yields` tags are present.
25
-
26
- <a name="user-content-require-yields-check-options"></a>
27
- <a name="require-yields-check-options"></a>
28
- ## Options
29
-
30
- - `checkGeneratorsOnly` - Avoids checking the function body and merely insists
31
- that all generators have `@yields`. This can be an optimization with the
32
- ESLint `require-yield` rule, as that rule already ensures a `yield` is
33
- present in generators, albeit assuming the generator is not empty).
34
- Defaults to `false`.
35
- - `next` - If `true`, this option will insist that any use of a (non-standard)
36
- `@next` tag (in addition to any `@yields` tag) will be matched by a `yield`
37
- which uses a return value in the body of the generator (e.g.,
38
- `const rv = yield;` or `const rv = yield value;`). This (non-standard)
39
- tag is intended to be used to indicate a type and/or description of
40
- the value expected to be supplied by the user when supplied to the iterator
41
- by its `next` method, as with `it.next(value)` (with the iterator being
42
- the `Generator` iterator that is returned by the call to the generator
43
- function). This option will report an error if the generator function body
44
- merely has plain `yield;` or `yield value;` statements without returning
45
- the values. Defaults to `false`.
46
-
47
- <a name="user-content-require-yields-check-context-and-settings"></a>
48
- <a name="require-yields-check-context-and-settings"></a>
49
- ## Context and settings
50
-
51
- |||
52
- |---|---|
53
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
54
- |Tags|`yields`|
55
- |Aliases|`yield`|
56
- |Recommended|true|
57
- |Options|`checkGeneratorsOnly`, `contexts`, `exemptedBy`, `next`|
58
-
59
- <a name="user-content-require-yields-check-failing-examples"></a>
60
- <a name="require-yields-check-failing-examples"></a>
61
- ## Failing examples
62
-
63
- The following patterns are considered problems:
64
-
65
- ````js
66
- /**
67
- * @yields
68
- */
69
- function * quux (foo) {
70
-
71
- }
72
- // Message: JSDoc @yields declaration present but yield expression not available in function.
73
-
74
- /**
75
- * @yields
76
- */
77
- function quux (foo) {
78
-
79
- }
80
- // "jsdoc/require-yields-check": ["error"|"warn", {"checkGeneratorsOnly":true}]
81
- // Message: JSDoc @yields declaration present but yield expression not available in function.
82
-
83
- /**
84
- * @next
85
- */
86
- function quux (foo) {
87
-
88
- }
89
- // "jsdoc/require-yields-check": ["error"|"warn", {"checkGeneratorsOnly":true,"next":true}]
90
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
91
-
92
- /**
93
- * @next {SomeType}
94
- */
95
- function * quux (foo) {
96
-
97
- }
98
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
99
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
100
-
101
- /**
102
- * @next {SomeType}
103
- */
104
- function * quux (foo) {
105
- yield;
106
- }
107
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
108
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
109
-
110
- /**
111
- * @next {SomeType}
112
- */
113
- function * quux (foo) {
114
- yield 5;
115
- }
116
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
117
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
118
-
119
- /**
120
- * @yield
121
- */
122
- function * quux (foo) {
123
-
124
- }
125
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":"yield"}}}
126
- // Message: JSDoc @yield declaration present but yield expression not available in function.
127
-
128
- /**
129
- * @yield-returns {Something}
130
- */
131
- function * quux (foo) {
132
- yield;
133
- }
134
- // Settings: {"jsdoc":{"tagNamePreference":{"next":"yield-returns"}}}
135
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
136
- // Message: JSDoc @yield-returns declaration present but yield expression with return value not available in function.
137
-
138
- /**
139
- * @yields {undefined} Foo.
140
- * @yields {String} Foo.
141
- */
142
- function * quux () {
143
-
144
- yield foo;
145
- }
146
- // Message: Found more than one @yields declaration.
147
-
148
- class Foo {
149
- /**
150
- * @yields {string}
151
- */
152
- * bar () {
153
- }
154
- }
155
- // Message: JSDoc @yields declaration present but yield expression not available in function.
156
-
157
- /**
158
- * @yields
159
- */
160
- function * quux () {
161
-
162
- }
163
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":false}}}
164
- // Message: Unexpected tag `@yields`
165
-
166
- /**
167
- * @next
168
- */
169
- function * quux () {
170
-
171
- }
172
- // Settings: {"jsdoc":{"tagNamePreference":{"next":false}}}
173
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
174
- // Message: Unexpected tag `@next`
175
-
176
- /**
177
- * @yields {string}
178
- */
179
- function * f () {
180
- function * g() {
181
- yield 'foo'
182
- }
183
- }
184
- // Message: JSDoc @yields declaration present but yield expression not available in function.
185
-
186
- /**
187
- * @yields {Promise<void>}
188
- */
189
- async function * quux() {}
190
- // Message: JSDoc @yields declaration present but yield expression not available in function.
191
-
192
- /**
193
- * @yields {Promise<void>}
194
- */
195
- const quux = async function * () {}
196
- // Message: JSDoc @yields declaration present but yield expression not available in function.
197
-
198
- /**
199
- * @yields {never} Foo.
200
- */
201
- function * quux () {
202
- yield 5;
203
- }
204
- // Message: JSDoc @yields declaration set with "never" but yield expression is present in function.
205
-
206
- /**
207
- * @next {never}
208
- */
209
- function * quux (foo) {
210
- const a = yield;
211
- }
212
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
213
- // Message: JSDoc @next declaration set with "never" but yield expression with return value is present in function.
214
- ````
215
-
216
-
217
-
218
- <a name="user-content-require-yields-check-passing-examples"></a>
219
- <a name="require-yields-check-passing-examples"></a>
220
- ## Passing examples
221
-
222
- The following patterns are not considered problems:
223
-
224
- ````js
225
- /**
226
- * @yields Foo.
227
- */
228
- function * quux () {
229
-
230
- yield foo;
231
- }
232
-
233
- /**
234
- * @yields {string} Foo.
235
- */
236
- function * quux () {
237
-
238
- yield foo;
239
- }
240
-
241
- /**
242
- * @yields {string} Foo.
243
- */
244
- function * quux () {
245
-
246
- yield foo;
247
- }
248
-
249
- /**
250
- *
251
- */
252
- function * quux () {
253
- }
254
-
255
- /**
256
- * @yields {undefined} Foo.
257
- */
258
- function * quux () {}
259
-
260
- /**
261
- * @yields { void } Foo.
262
- */
263
- function quux () {}
264
-
265
- /**
266
- * @yields Foo.
267
- * @abstract
268
- */
269
- function * quux () {
270
- throw new Error('must be implemented by subclass!');
271
- }
272
-
273
- /**
274
- * @yields Foo.
275
- * @virtual
276
- */
277
- function * quux () {
278
- throw new Error('must be implemented by subclass!');
279
- }
280
-
281
- /**
282
- * @yields Foo.
283
- * @constructor
284
- */
285
- function * quux () {
286
- }
287
-
288
- /**
289
- * @interface
290
- */
291
- class Foo {
292
- /**
293
- * @yields {string}
294
- */
295
- * bar () {
296
- }
297
- }
298
-
299
- /**
300
- * @record
301
- */
302
- class Foo {
303
- /**
304
- * @yields {string}
305
- */
306
- * bar () {
307
- }
308
- }
309
- // Settings: {"jsdoc":{"mode":"closure"}}
310
-
311
- /**
312
- * @yields {undefined} Foo.
313
- */
314
- function * quux () {
315
- }
316
-
317
- /**
318
- * @yields {void} Foo.
319
- */
320
- function * quux () {
321
- }
322
-
323
- /**
324
- * @yields {never} Foo.
325
- */
326
- function * quux () {
327
- }
328
-
329
- /**
330
- * @yields {void} Foo.
331
- */
332
- function * quux () {
333
- yield undefined;
334
- }
335
-
336
- /**
337
- * @yields {void} Foo.
338
- */
339
- function * quux () {
340
- yield;
341
- }
342
-
343
- /**
344
- *
345
- */
346
- function * quux () {
347
- yield undefined;
348
- }
349
-
350
- /**
351
- *
352
- */
353
- function * quux () {
354
- yield;
355
- }
356
-
357
- /**
358
- * @yields {true}
359
- */
360
- function * quux () {
361
- try {
362
- yield true;
363
- } catch (err) {
364
- }
365
- yield;
366
- }
367
-
368
- /**
369
- * @yields {true}
370
- */
371
- function * quux () {
372
- try {
373
- } finally {
374
- yield true;
375
- }
376
- yield;
377
- }
378
-
379
- /**
380
- * @yields {true}
381
- */
382
- function * quux () {
383
- try {
384
- yield;
385
- } catch (err) {
386
- }
387
- yield true;
388
- }
389
-
390
- /**
391
- * @yields {true}
392
- */
393
- function * quux () {
394
- try {
395
- something();
396
- } catch (err) {
397
- yield true;
398
- }
399
- yield;
400
- }
401
-
402
- /**
403
- * @yields {true}
404
- */
405
- function * quux () {
406
- switch (true) {
407
- case 'abc':
408
- yield true;
409
- }
410
- yield;
411
- }
412
-
413
- /**
414
- * @yields {true}
415
- */
416
- function * quux () {
417
- switch (true) {
418
- case 'abc':
419
- yield;
420
- }
421
- yield true;
422
- }
423
-
424
- /**
425
- * @yields {true}
426
- */
427
- function * quux () {
428
- for (const i of abc) {
429
- yield true;
430
- }
431
- yield;
432
- }
433
-
434
- /**
435
- * @yields {true}
436
- */
437
- function * quux () {
438
- for (const a in b) {
439
- yield true;
440
- }
441
- }
442
-
443
- /**
444
- * @yields {true}
445
- */
446
- function * quux () {
447
- for (let i=0; i<n; i+=1) {
448
- yield true;
449
- }
450
- }
451
-
452
- /**
453
- * @yields {true}
454
- */
455
- function * quux () {
456
- while(true) {
457
- yield true
458
- }
459
- }
460
-
461
- /**
462
- * @yields {true}
463
- */
464
- function * quux () {
465
- do {
466
- yield true
467
- }
468
- while(true)
469
- }
470
-
471
- /**
472
- * @yields {true}
473
- */
474
- function * quux () {
475
- if (true) {
476
- yield;
477
- }
478
- yield true;
479
- }
480
-
481
- /**
482
- * @yields {true}
483
- */
484
- function * quux () {
485
- if (true) {
486
- yield true;
487
- }
488
- }
489
-
490
- /**
491
- * @yields {true}
492
- */
493
- function * quux () {
494
- var a = {};
495
- with (a) {
496
- yield true;
497
- }
498
- }
499
-
500
- /**
501
- * @yields {true}
502
- */
503
- function * quux () {
504
- if (true) {
505
- yield;
506
- } else {
507
- yield true;
508
- }
509
- yield;
510
- }
511
-
512
- /**
513
- * @next {void}
514
- */
515
- function * quux (foo) {
516
-
517
- }
518
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
519
-
520
- /**
521
- * @next {SomeType}
522
- */
523
- function * quux (foo) {
524
- const a = yield;
525
- }
526
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
527
-
528
- /**
529
- * @next {SomeType}
530
- */
531
- function * quux (foo) {
532
- const a = yield 5;
533
- }
534
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
535
-
536
- /**
537
- * @next {never}
538
- */
539
- function * quux (foo) {
540
-
541
- }
542
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
543
- ````
544
-