eslint-plugin-jsdoc 46.4.6 → 46.5.1

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 (191) hide show
  1. package/README.md +31 -0
  2. package/dist/index.js +21 -10
  3. package/dist/index.js.map +1 -1
  4. package/dist/jsdocUtils.js +1 -1
  5. package/dist/jsdocUtils.js.map +1 -1
  6. package/dist/rules/matchDescription.js +1 -1
  7. package/dist/rules/matchDescription.js.map +1 -1
  8. package/package.json +14 -12
  9. package/dist/WarnSettings.d.ts +0 -17
  10. package/dist/WarnSettings.d.ts.map +0 -1
  11. package/dist/alignTransform.d.ts +0 -32
  12. package/dist/alignTransform.d.ts.map +0 -1
  13. package/dist/defaultTagOrder.d.ts +0 -5
  14. package/dist/defaultTagOrder.d.ts.map +0 -1
  15. package/dist/exportParser.d.ts +0 -41
  16. package/dist/exportParser.d.ts.map +0 -1
  17. package/dist/getDefaultTagStructureForMode.d.ts +0 -11
  18. package/dist/getDefaultTagStructureForMode.d.ts.map +0 -1
  19. package/dist/index.d.ts +0 -10
  20. package/dist/index.d.ts.map +0 -1
  21. package/dist/iterateJsdoc.d.ts +0 -460
  22. package/dist/iterateJsdoc.d.ts.map +0 -1
  23. package/dist/jsdocUtils.d.ts +0 -421
  24. package/dist/jsdocUtils.d.ts.map +0 -1
  25. package/dist/rules/checkAccess.d.ts +0 -3
  26. package/dist/rules/checkAccess.d.ts.map +0 -1
  27. package/dist/rules/checkAlignment.d.ts +0 -3
  28. package/dist/rules/checkAlignment.d.ts.map +0 -1
  29. package/dist/rules/checkExamples.d.ts +0 -4
  30. package/dist/rules/checkExamples.d.ts.map +0 -1
  31. package/dist/rules/checkIndentation.d.ts +0 -3
  32. package/dist/rules/checkIndentation.d.ts.map +0 -1
  33. package/dist/rules/checkLineAlignment.d.ts +0 -10
  34. package/dist/rules/checkLineAlignment.d.ts.map +0 -1
  35. package/dist/rules/checkParamNames.d.ts +0 -3
  36. package/dist/rules/checkParamNames.d.ts.map +0 -1
  37. package/dist/rules/checkPropertyNames.d.ts +0 -3
  38. package/dist/rules/checkPropertyNames.d.ts.map +0 -1
  39. package/dist/rules/checkSyntax.d.ts +0 -3
  40. package/dist/rules/checkSyntax.d.ts.map +0 -1
  41. package/dist/rules/checkTagNames.d.ts +0 -3
  42. package/dist/rules/checkTagNames.d.ts.map +0 -1
  43. package/dist/rules/checkTypes.d.ts +0 -3
  44. package/dist/rules/checkTypes.d.ts.map +0 -1
  45. package/dist/rules/checkValues.d.ts +0 -3
  46. package/dist/rules/checkValues.d.ts.map +0 -1
  47. package/dist/rules/emptyTags.d.ts +0 -3
  48. package/dist/rules/emptyTags.d.ts.map +0 -1
  49. package/dist/rules/implementsOnClasses.d.ts +0 -3
  50. package/dist/rules/implementsOnClasses.d.ts.map +0 -1
  51. package/dist/rules/importsAsDependencies.d.ts +0 -3
  52. package/dist/rules/importsAsDependencies.d.ts.map +0 -1
  53. package/dist/rules/informativeDocs.d.ts +0 -3
  54. package/dist/rules/informativeDocs.d.ts.map +0 -1
  55. package/dist/rules/matchDescription.d.ts +0 -3
  56. package/dist/rules/matchDescription.d.ts.map +0 -1
  57. package/dist/rules/matchName.d.ts +0 -3
  58. package/dist/rules/matchName.d.ts.map +0 -1
  59. package/dist/rules/multilineBlocks.d.ts +0 -3
  60. package/dist/rules/multilineBlocks.d.ts.map +0 -1
  61. package/dist/rules/noBadBlocks.d.ts +0 -3
  62. package/dist/rules/noBadBlocks.d.ts.map +0 -1
  63. package/dist/rules/noBlankBlockDescriptions.d.ts +0 -3
  64. package/dist/rules/noBlankBlockDescriptions.d.ts.map +0 -1
  65. package/dist/rules/noBlankBlocks.d.ts +0 -3
  66. package/dist/rules/noBlankBlocks.d.ts.map +0 -1
  67. package/dist/rules/noDefaults.d.ts +0 -3
  68. package/dist/rules/noDefaults.d.ts.map +0 -1
  69. package/dist/rules/noMissingSyntax.d.ts +0 -10
  70. package/dist/rules/noMissingSyntax.d.ts.map +0 -1
  71. package/dist/rules/noMultiAsterisks.d.ts +0 -3
  72. package/dist/rules/noMultiAsterisks.d.ts.map +0 -1
  73. package/dist/rules/noRestrictedSyntax.d.ts +0 -3
  74. package/dist/rules/noRestrictedSyntax.d.ts.map +0 -1
  75. package/dist/rules/noTypes.d.ts +0 -3
  76. package/dist/rules/noTypes.d.ts.map +0 -1
  77. package/dist/rules/noUndefinedTypes.d.ts +0 -3
  78. package/dist/rules/noUndefinedTypes.d.ts.map +0 -1
  79. package/dist/rules/requireAsteriskPrefix.d.ts +0 -3
  80. package/dist/rules/requireAsteriskPrefix.d.ts.map +0 -1
  81. package/dist/rules/requireDescription.d.ts +0 -3
  82. package/dist/rules/requireDescription.d.ts.map +0 -1
  83. package/dist/rules/requireDescriptionCompleteSentence.d.ts +0 -3
  84. package/dist/rules/requireDescriptionCompleteSentence.d.ts.map +0 -1
  85. package/dist/rules/requireExample.d.ts +0 -3
  86. package/dist/rules/requireExample.d.ts.map +0 -1
  87. package/dist/rules/requireFileOverview.d.ts +0 -3
  88. package/dist/rules/requireFileOverview.d.ts.map +0 -1
  89. package/dist/rules/requireHyphenBeforeParamDescription.d.ts +0 -3
  90. package/dist/rules/requireHyphenBeforeParamDescription.d.ts.map +0 -1
  91. package/dist/rules/requireJsdoc.d.ts +0 -9
  92. package/dist/rules/requireJsdoc.d.ts.map +0 -1
  93. package/dist/rules/requireParam.d.ts +0 -4
  94. package/dist/rules/requireParam.d.ts.map +0 -1
  95. package/dist/rules/requireParamDescription.d.ts +0 -3
  96. package/dist/rules/requireParamDescription.d.ts.map +0 -1
  97. package/dist/rules/requireParamName.d.ts +0 -3
  98. package/dist/rules/requireParamName.d.ts.map +0 -1
  99. package/dist/rules/requireParamType.d.ts +0 -3
  100. package/dist/rules/requireParamType.d.ts.map +0 -1
  101. package/dist/rules/requireProperty.d.ts +0 -3
  102. package/dist/rules/requireProperty.d.ts.map +0 -1
  103. package/dist/rules/requirePropertyDescription.d.ts +0 -3
  104. package/dist/rules/requirePropertyDescription.d.ts.map +0 -1
  105. package/dist/rules/requirePropertyName.d.ts +0 -3
  106. package/dist/rules/requirePropertyName.d.ts.map +0 -1
  107. package/dist/rules/requirePropertyType.d.ts +0 -3
  108. package/dist/rules/requirePropertyType.d.ts.map +0 -1
  109. package/dist/rules/requireReturns.d.ts +0 -3
  110. package/dist/rules/requireReturns.d.ts.map +0 -1
  111. package/dist/rules/requireReturnsCheck.d.ts +0 -3
  112. package/dist/rules/requireReturnsCheck.d.ts.map +0 -1
  113. package/dist/rules/requireReturnsDescription.d.ts +0 -3
  114. package/dist/rules/requireReturnsDescription.d.ts.map +0 -1
  115. package/dist/rules/requireReturnsType.d.ts +0 -3
  116. package/dist/rules/requireReturnsType.d.ts.map +0 -1
  117. package/dist/rules/requireThrows.d.ts +0 -3
  118. package/dist/rules/requireThrows.d.ts.map +0 -1
  119. package/dist/rules/requireYields.d.ts +0 -3
  120. package/dist/rules/requireYields.d.ts.map +0 -1
  121. package/dist/rules/requireYieldsCheck.d.ts +0 -3
  122. package/dist/rules/requireYieldsCheck.d.ts.map +0 -1
  123. package/dist/rules/sortTags.d.ts +0 -3
  124. package/dist/rules/sortTags.d.ts.map +0 -1
  125. package/dist/rules/tagLines.d.ts +0 -3
  126. package/dist/rules/tagLines.d.ts.map +0 -1
  127. package/dist/rules/textEscaping.d.ts +0 -3
  128. package/dist/rules/textEscaping.d.ts.map +0 -1
  129. package/dist/rules/validTypes.d.ts +0 -3
  130. package/dist/rules/validTypes.d.ts.map +0 -1
  131. package/dist/tagNames.d.ts +0 -16
  132. package/dist/tagNames.d.ts.map +0 -1
  133. package/dist/utils/hasReturnValue.d.ts +0 -20
  134. package/dist/utils/hasReturnValue.d.ts.map +0 -1
  135. package/docs/advanced.md +0 -102
  136. package/docs/rules/check-access.md +0 -193
  137. package/docs/rules/check-alignment.md +0 -169
  138. package/docs/rules/check-examples.md +0 -784
  139. package/docs/rules/check-indentation.md +0 -296
  140. package/docs/rules/check-line-alignment.md +0 -1002
  141. package/docs/rules/check-param-names.md +0 -1035
  142. package/docs/rules/check-property-names.md +0 -244
  143. package/docs/rules/check-syntax.md +0 -80
  144. package/docs/rules/check-tag-names.md +0 -1132
  145. package/docs/rules/check-types.md +0 -1198
  146. package/docs/rules/check-values.md +0 -409
  147. package/docs/rules/empty-tags.md +0 -220
  148. package/docs/rules/implements-on-classes.md +0 -219
  149. package/docs/rules/imports-as-dependencies.md +0 -99
  150. package/docs/rules/informative-docs.md +0 -400
  151. package/docs/rules/match-description.md +0 -1008
  152. package/docs/rules/match-name.md +0 -249
  153. package/docs/rules/multiline-blocks.md +0 -398
  154. package/docs/rules/no-bad-blocks.md +0 -174
  155. package/docs/rules/no-blank-block-descriptions.md +0 -91
  156. package/docs/rules/no-blank-blocks.md +0 -98
  157. package/docs/rules/no-defaults.md +0 -207
  158. package/docs/rules/no-missing-syntax.md +0 -275
  159. package/docs/rules/no-multi-asterisks.md +0 -278
  160. package/docs/rules/no-restricted-syntax.md +0 -383
  161. package/docs/rules/no-types.md +0 -168
  162. package/docs/rules/no-undefined-types.md +0 -789
  163. package/docs/rules/require-asterisk-prefix.md +0 -297
  164. package/docs/rules/require-description-complete-sentence.md +0 -820
  165. package/docs/rules/require-description.md +0 -585
  166. package/docs/rules/require-example.md +0 -390
  167. package/docs/rules/require-file-overview.md +0 -324
  168. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  169. package/docs/rules/require-jsdoc.md +0 -1857
  170. package/docs/rules/require-param-description.md +0 -238
  171. package/docs/rules/require-param-name.md +0 -163
  172. package/docs/rules/require-param-type.md +0 -227
  173. package/docs/rules/require-param.md +0 -1820
  174. package/docs/rules/require-property-description.md +0 -88
  175. package/docs/rules/require-property-name.md +0 -79
  176. package/docs/rules/require-property-type.md +0 -79
  177. package/docs/rules/require-property.md +0 -128
  178. package/docs/rules/require-returns-check.md +0 -1053
  179. package/docs/rules/require-returns-description.md +0 -181
  180. package/docs/rules/require-returns-type.md +0 -144
  181. package/docs/rules/require-returns.md +0 -1191
  182. package/docs/rules/require-throws.md +0 -326
  183. package/docs/rules/require-yields-check.md +0 -544
  184. package/docs/rules/require-yields.md +0 -823
  185. package/docs/rules/sort-tags.md +0 -635
  186. package/docs/rules/tag-lines.md +0 -551
  187. package/docs/rules/text-escaping.md +0 -177
  188. package/docs/rules/valid-types.md +0 -881
  189. package/docs/settings.md +0 -362
  190. package/tsconfig-prod.json +0 -20
  191. package/tsconfig.json +0 -21
@@ -1,823 +0,0 @@
1
- <a name="user-content-require-yields"></a>
2
- <a name="require-yields"></a>
3
- # <code>require-yields</code>
4
-
5
- * [Options](#user-content-require-yields-options)
6
- * [Context and settings](#user-content-require-yields-context-and-settings)
7
- * [Failing examples](#user-content-require-yields-failing-examples)
8
- * [Passing examples](#user-content-require-yields-passing-examples)
9
-
10
-
11
- Requires that yields are documented.
12
-
13
- Will also report if multiple `@yields` tags are present.
14
-
15
- See the `next`, `forceRequireNext`, and `nextWithGeneratorTag` options for an
16
- option to expect a non-standard `@next` tag.
17
-
18
- <a name="user-content-require-yields-options"></a>
19
- <a name="require-yields-options"></a>
20
- ## Options
21
-
22
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
23
- document block avoids the need for a `@yields`. Defaults to an array
24
- with `inheritdoc`. If you set this array, it will overwrite the default,
25
- so be sure to add back `inheritdoc` if you wish its presence to cause
26
- exemption of the rule.
27
- - `forceRequireYields` - Set to `true` to always insist on
28
- `@yields` documentation for generators even if there are only
29
- expressionless `yield` statements in the function. May be desired to flag
30
- that a project is aware of an `undefined`/`void` yield. Defaults to
31
- `false`.
32
- - `contexts` - Set this to an array of strings representing the AST context
33
- (or an object with `context` and `comment` properties) where you wish
34
- the rule to be applied.
35
- Overrides the default contexts (see below). Set to `"any"` if you want
36
- the rule to apply to any jsdoc block throughout your files (as is necessary
37
- for finding function blocks not attached to a function declaration or
38
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
39
- `@method`) (including those associated with an `@interface`). This
40
- rule will only apply on non-default contexts when there is such a tag
41
- present and the `forceRequireYields` option is set or if the
42
- `withGeneratorTag` option is set with a present `@generator` tag
43
- (since we are not checking against the actual `yield` values in these
44
- cases).
45
- - `withGeneratorTag` - If a `@generator` tag is present on a block, require
46
- `@yields`/`@yield`. Defaults to `true`. See `contexts` to `any` if you want
47
- to catch `@generator` with `@callback` or such not attached to a function.
48
- - `next` - If `true`, this option will insist that any use of a `yield` return
49
- value (e.g., `const rv = yield;` or `const rv = yield value;`) has a
50
- (non-standard) `@next` tag (in addition to any `@yields` tag) so as to be
51
- able to document the type expected to be supplied into the iterator
52
- (the `Generator` iterator that is returned by the call to the generator
53
- function) to the iterator (e.g., `it.next(value)`). The tag will not be
54
- expected if the generator function body merely has plain `yield;` or
55
- `yield value;` statements without returning the values. Defaults to
56
- `false`.
57
- - `forceRequireNext` - Set to `true` to always insist on
58
- `@next` documentation even if there are no `yield` statements in the
59
- function or none return values. May be desired to flag that a project is
60
- aware of the expected yield return being `undefined`. Defaults to `false`.
61
- - `nextWithGeneratorTag` - If a `@generator` tag is present on a block, require
62
- (non-standard ) `@next` (see `next` option). This will require using `void`
63
- or `undefined` in cases where generators do not use the `next()`-supplied
64
- incoming `yield`-returned value. Defaults to `false`. See `contexts` to
65
- `any` if you want to catch `@generator` with `@callback` or such not
66
- attached to a function.
67
-
68
- <a name="user-content-require-yields-context-and-settings"></a>
69
- <a name="require-yields-context-and-settings"></a>
70
- ## Context and settings
71
-
72
- |||
73
- |---|---|
74
- |Context|Generator functions (`FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled)|
75
- |Tags|`yields`|
76
- |Aliases|`yield`|
77
- |Recommended|true|
78
- | Options |`contexts`, `exemptedBy`, `forceRequireNext`, `forceRequireYields`, `next`, `nextWithGeneratorTag`, `withGeneratorTag`|
79
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
80
-
81
- <a name="user-content-require-yields-failing-examples"></a>
82
- <a name="require-yields-failing-examples"></a>
83
- ## Failing examples
84
-
85
- The following patterns are considered problems:
86
-
87
- ````js
88
- /**
89
- *
90
- */
91
- function * quux (foo) {
92
-
93
- yield foo;
94
- }
95
- // Message: Missing JSDoc @yields declaration.
96
-
97
- /**
98
- * @yields
99
- */
100
- function * quux (foo) {
101
-
102
- const retVal = yield foo;
103
- }
104
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
105
- // Message: Missing JSDoc @next declaration.
106
-
107
- /**
108
- * @yields
109
- */
110
- function * quux (foo) {
111
-
112
- const retVal = yield;
113
- }
114
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
115
- // Message: Missing JSDoc @next declaration.
116
-
117
- /**
118
- * @yields {void}
119
- */
120
- function * quux () {
121
- }
122
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
123
- // Message: Missing JSDoc @next declaration.
124
-
125
- /**
126
- * @yields {void}
127
- */
128
- function * quux () {
129
- yield;
130
- }
131
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
132
- // Message: Missing JSDoc @next declaration.
133
-
134
- /**
135
- *
136
- */
137
- function * quux (foo) {
138
-
139
- const a = yield foo;
140
- }
141
- // Message: Missing JSDoc @yields declaration.
142
-
143
- /**
144
- *
145
- */
146
- function * quux (foo) {
147
- yield foo;
148
- }
149
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":"yield"}}}
150
- // Message: Missing JSDoc @yield declaration.
151
-
152
- /**
153
- * @yields
154
- */
155
- function * quux (foo) {
156
- const val = yield foo;
157
- }
158
- // Settings: {"jsdoc":{"tagNamePreference":{"next":"yield-returns"}}}
159
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
160
- // Message: Missing JSDoc @yield-returns declaration.
161
-
162
- /**
163
- * @yields
164
- * @next
165
- */
166
- function * quux () {
167
- const ret = yield 5;
168
- }
169
- // Settings: {"jsdoc":{"tagNamePreference":{"next":false}}}
170
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
171
- // Message: Unexpected tag `@next`
172
-
173
- /**
174
- *
175
- */
176
- function * quux() {
177
- yield 5;
178
- }
179
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
180
- // Message: Missing JSDoc @yields declaration.
181
-
182
- /**
183
- *
184
- */
185
- function * quux() {
186
- yield;
187
- }
188
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
189
- // Message: Missing JSDoc @yields declaration.
190
-
191
- /**
192
- *
193
- */
194
- const quux = async function * () {
195
- yield;
196
- }
197
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
198
- // Message: Missing JSDoc @yields declaration.
199
-
200
- /**
201
- *
202
- */
203
- async function * quux () {
204
- yield;
205
- }
206
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
207
- // Message: Missing JSDoc @yields declaration.
208
-
209
- /**
210
- *
211
- */
212
- function * quux () {
213
- yield;
214
- }
215
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
216
- // Message: Missing JSDoc @yields declaration.
217
-
218
- /**
219
- * @function
220
- * @generator
221
- */
222
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
223
- // Message: Missing JSDoc @yields declaration.
224
-
225
- /**
226
- * @callback
227
- * @generator
228
- */
229
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
230
- // Message: Missing JSDoc @yields declaration.
231
-
232
- /**
233
- * @yields {undefined}
234
- * @yields {void}
235
- */
236
- function * quux (foo) {
237
-
238
- return foo;
239
- }
240
- // Message: Found more than one @yields declaration.
241
-
242
- /**
243
- * @yields
244
- */
245
- function * quux () {
246
-
247
- }
248
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":false}}}
249
- // Message: Unexpected tag `@yields`
250
-
251
- /**
252
- * @param foo
253
- */
254
- function * quux (foo) {
255
- yield 'bar';
256
- }
257
- // "jsdoc/require-yields": ["error"|"warn", {"exemptedBy":["notPresent"]}]
258
- // Message: Missing JSDoc @yields declaration.
259
-
260
- /**
261
- * @param {array} a
262
- */
263
- async function * foo(a) {
264
- return;
265
- }
266
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
267
- // Message: Missing JSDoc @yields declaration.
268
-
269
- /**
270
- * @param {array} a
271
- */
272
- async function * foo(a) {
273
- yield Promise.all(a);
274
- }
275
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
276
- // Message: Missing JSDoc @yields declaration.
277
-
278
- class quux {
279
- /**
280
- *
281
- */
282
- * quux () {
283
- yield;
284
- }
285
- }
286
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
287
- // Message: Missing JSDoc @yields declaration.
288
-
289
- /**
290
- * @param {array} a
291
- */
292
- async function * foo(a) {
293
- yield Promise.all(a);
294
- }
295
- // Message: Missing JSDoc @yields declaration.
296
-
297
- /**
298
- * @generator
299
- */
300
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":true}]
301
- // Message: Missing JSDoc @yields declaration.
302
-
303
- /**
304
- * @generator
305
- * @yields
306
- */
307
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
308
- // Message: Missing JSDoc @next declaration.
309
-
310
- /**
311
- *
312
- */
313
- function * quux () {
314
- if (true) {
315
- yield;
316
- }
317
- yield true;
318
- }
319
- // Message: Missing JSDoc @yields declaration.
320
-
321
- /**
322
- *
323
- */
324
- function * quux () {
325
- try {
326
- yield true;
327
- } catch (err) {
328
- }
329
- yield;
330
- }
331
- // Message: Missing JSDoc @yields declaration.
332
-
333
- /**
334
- *
335
- */
336
- function * quux () {
337
- try {
338
- } finally {
339
- yield true;
340
- }
341
- yield;
342
- }
343
- // Message: Missing JSDoc @yields declaration.
344
-
345
- /**
346
- *
347
- */
348
- function * quux () {
349
- try {
350
- yield;
351
- } catch (err) {
352
- }
353
- yield true;
354
- }
355
- // Message: Missing JSDoc @yields declaration.
356
-
357
- /**
358
- *
359
- */
360
- function * quux () {
361
- try {
362
- something();
363
- } catch (err) {
364
- yield true;
365
- }
366
- yield;
367
- }
368
- // Message: Missing JSDoc @yields declaration.
369
-
370
- /**
371
- *
372
- */
373
- function * quux () {
374
- switch (true) {
375
- case 'abc':
376
- yield true;
377
- }
378
- yield;
379
- }
380
- // Message: Missing JSDoc @yields declaration.
381
-
382
- /**
383
- *
384
- */
385
- function * quux () {
386
- switch (true) {
387
- case 'abc':
388
- yield;
389
- }
390
- yield true;
391
- }
392
- // Message: Missing JSDoc @yields declaration.
393
-
394
- /**
395
- *
396
- */
397
- function * quux () {
398
- for (const i of abc) {
399
- yield true;
400
- }
401
- yield;
402
- }
403
- // Message: Missing JSDoc @yields declaration.
404
-
405
- /**
406
- *
407
- */
408
- function * quux () {
409
- for (const a in b) {
410
- yield true;
411
- }
412
- }
413
- // Message: Missing JSDoc @yields declaration.
414
-
415
- /**
416
- *
417
- */
418
- function * quux () {
419
- for (let i=0; i<n; i+=1) {
420
- yield true;
421
- }
422
- }
423
- // Message: Missing JSDoc @yields declaration.
424
-
425
- /**
426
- *
427
- */
428
- function * quux () {
429
- while(true) {
430
- yield true
431
- }
432
- }
433
- // Message: Missing JSDoc @yields declaration.
434
-
435
- /**
436
- *
437
- */
438
- function * quux () {
439
- do {
440
- yield true
441
- }
442
- while(true)
443
- }
444
- // Message: Missing JSDoc @yields declaration.
445
-
446
- /**
447
- *
448
- */
449
- function * quux () {
450
- if (true) {
451
- yield;
452
- }
453
- yield true;
454
- }
455
- // Message: Missing JSDoc @yields declaration.
456
-
457
- /**
458
- *
459
- */
460
- function * quux () {
461
- if (true) {
462
- yield true;
463
- }
464
- }
465
- // Message: Missing JSDoc @yields declaration.
466
-
467
- /**
468
- *
469
- */
470
- function * quux () {
471
- var a = {};
472
- with (a) {
473
- yield true;
474
- }
475
- }
476
- // Message: Missing JSDoc @yields declaration.
477
-
478
- /**
479
- *
480
- */
481
- function * quux () {
482
- if (true) {
483
- yield;
484
- } else {
485
- yield true;
486
- }
487
- yield;
488
- }
489
- // Message: Missing JSDoc @yields declaration.
490
- ````
491
-
492
-
493
-
494
- <a name="user-content-require-yields-passing-examples"></a>
495
- <a name="require-yields-passing-examples"></a>
496
- ## Passing examples
497
-
498
- The following patterns are not considered problems:
499
-
500
- ````js
501
- /**
502
- * @yields Foo.
503
- */
504
- function * quux () {
505
-
506
- yield foo;
507
- }
508
-
509
- /**
510
- * @yields Foo.
511
- */
512
- function * quux () {
513
-
514
- yield foo;
515
- }
516
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
517
-
518
- /**
519
- *
520
- */
521
- function * quux () {
522
- }
523
-
524
- /**
525
- *
526
- */
527
- function * quux () {
528
- yield;
529
- }
530
-
531
- /**
532
- *
533
- */
534
- function quux (bar) {
535
- bar.doSomething(function * (baz) {
536
- yield baz.corge();
537
- })
538
- }
539
-
540
- /**
541
- * @yields {Array}
542
- */
543
- function * quux (bar) {
544
- yield bar.doSomething(function * (baz) {
545
- yield baz.corge();
546
- })
547
- }
548
-
549
- /**
550
- * @inheritdoc
551
- */
552
- function * quux (foo) {
553
- }
554
-
555
- /**
556
- * @override
557
- */
558
- function * quux (foo) {
559
- }
560
-
561
- /**
562
- * @constructor
563
- */
564
- function * quux (foo) {
565
- }
566
-
567
- /**
568
- * @implements
569
- */
570
- function * quux (foo) {
571
- yield;
572
- }
573
-
574
- /**
575
- * @override
576
- */
577
- function * quux (foo) {
578
-
579
- yield foo;
580
- }
581
-
582
- /**
583
- * @class
584
- */
585
- function * quux (foo) {
586
- yield foo;
587
- }
588
-
589
- /**
590
- * @constructor
591
- */
592
- function * quux (foo) {
593
- }
594
-
595
- /**
596
- * @yields {object}
597
- */
598
- function * quux () {
599
-
600
- yield {a: foo};
601
- }
602
-
603
- /**
604
- * @yields {void}
605
- */
606
- function * quux () {
607
- }
608
-
609
- /**
610
- * @yields {undefined}
611
- */
612
- function * quux () {
613
- }
614
-
615
- /**
616
- *
617
- */
618
- function * quux () {
619
- }
620
-
621
- /**
622
- * @yields {void}
623
- */
624
- function quux () {
625
- }
626
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
627
-
628
- /**
629
- * @yields {void}
630
- * @next {void}
631
- */
632
- function * quux () {
633
- }
634
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
635
-
636
- /**
637
- * @yields {void}
638
- */
639
- function * quux () {
640
- yield undefined;
641
- }
642
-
643
- /**
644
- * @yields {void}
645
- */
646
- function * quux () {
647
- yield undefined;
648
- }
649
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
650
-
651
- /**
652
- * @yields {void}
653
- */
654
- function * quux () {
655
- yield;
656
- }
657
-
658
- /**
659
- * @yields {void}
660
- */
661
- function * quux () {
662
- }
663
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
664
-
665
- /**
666
- * @yields {void}
667
- */
668
- function * quux () {
669
- yield;
670
- }
671
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
672
-
673
- /** @type {SpecialIterator} */
674
- function * quux () {
675
- yield 5;
676
- }
677
-
678
- /**
679
- * @yields {Something}
680
- */
681
- async function * quux () {
682
- }
683
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
684
-
685
- /**
686
- *
687
- */
688
- async function * quux () {}
689
-
690
- /**
691
- *
692
- */
693
- const quux = async function * () {}
694
-
695
- /**
696
- * @type {MyCallback}
697
- */
698
- function * quux () {
699
- yield;
700
- }
701
- // "jsdoc/require-yields": ["error"|"warn", {"exemptedBy":["type"]}]
702
-
703
- /**
704
- * @param {array} a
705
- */
706
- async function * foo (a) {
707
- yield;
708
- }
709
-
710
- /**
711
- *
712
- */
713
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
714
-
715
- /**
716
- * @function
717
- */
718
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
719
-
720
- /**
721
- * @function
722
- */
723
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
724
-
725
- /**
726
- * @callback
727
- */
728
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
729
-
730
- /**
731
- * @generator
732
- */
733
- // "jsdoc/require-yields": ["error"|"warn", {"withGeneratorTag":true}]
734
-
735
- /**
736
- * @generator
737
- */
738
- // "jsdoc/require-yields": ["error"|"warn", {"nextWithGeneratorTag":true}]
739
-
740
- /**
741
- * @generator
742
- * @yields
743
- */
744
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":true}]
745
-
746
- /**
747
- * @generator
748
- * @yields
749
- * @next
750
- */
751
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
752
-
753
- /**
754
- * @generator
755
- */
756
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":false}]
757
-
758
- /**
759
- * @generator
760
- * @yields
761
- */
762
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":false}]
763
-
764
- /**
765
- * @yields
766
- */
767
- function * quux (foo) {
768
-
769
- const a = yield foo;
770
- }
771
-
772
- /**
773
- * @yields
774
- * @next
775
- */
776
- function * quux (foo) {
777
- let a = yield;
778
- }
779
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
780
-
781
- /**
782
- * @yields
783
- * @next
784
- */
785
- function * quux (foo) {
786
- const a = yield foo;
787
- }
788
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
789
-
790
- /**
791
- *
792
- */
793
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
794
-
795
- /**
796
- *
797
- */
798
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"next":true}]
799
-
800
- /**
801
- *
802
- */
803
- function quux () {}
804
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"next":true}]
805
-
806
- /**
807
- * @yields {void}
808
- */
809
- function * quux () {
810
- yield;
811
- }
812
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
813
-
814
- /**
815
- *
816
- */
817
- function * quux (foo) {
818
- const a = function * bar () {
819
- yield foo;
820
- }
821
- }
822
- ````
823
-