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,789 +0,0 @@
1
- <a name="user-content-no-undefined-types"></a>
2
- <a name="no-undefined-types"></a>
3
- # <code>no-undefined-types</code>
4
-
5
- * [Options](#user-content-no-undefined-types-options)
6
- * [Context and settings](#user-content-no-undefined-types-context-and-settings)
7
- * [Failing examples](#user-content-no-undefined-types-failing-examples)
8
- * [Passing examples](#user-content-no-undefined-types-passing-examples)
9
-
10
-
11
- Checks that types in jsdoc comments are defined. This can be used to check
12
- unimported types.
13
-
14
- When enabling this rule, types in jsdoc comments will resolve as used
15
- variables, i.e. will not be marked as unused by `no-unused-vars`.
16
-
17
- In addition to considering globals found in code (or in ESLint-indicated
18
- `globals`) as defined, the following tags will also be checked for
19
- name(path) definitions to also serve as a potential "type" for checking
20
- the tag types in the table below:
21
-
22
- `@callback`, `@class` (or `@constructor`), `@constant` (or `@const`),
23
- `@event`, `@external` (or `@host`), `@function` (or `@func` or `@method`),
24
- `@interface`, `@member` (or `@var`), `@mixin`, `@name`, `@namespace`,
25
- `@template` (for "closure" or "typescript" `settings.jsdoc.mode` only),
26
- `@typedef`.
27
-
28
- The following tags will also be checked but only when the mode is `closure`:
29
-
30
- `@package`, `@private`, `@protected`, `@public`, `@static`
31
-
32
- The following types are always considered defined.
33
-
34
- - `null`, `undefined`, `void`, `string`, `boolean`, `object`,
35
- `function`, `symbol`
36
- - `number`, `bigint`, `NaN`, `Infinity`
37
- - `any`, `*`, `never`, `unknown`, `const`
38
- - `this`, `true`, `false`
39
- - `Array`, `Object`, `RegExp`, `Date`, `Function`
40
-
41
- Note that preferred types indicated within `settings.jsdoc.preferredTypes` will
42
- also be assumed to be defined.
43
-
44
- Also note that if there is an error [parsing](https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser)
45
- types for a tag, the function will silently ignore that tag, leaving it to
46
- the `valid-types` rule to report parsing errors.
47
-
48
- If you define your own tags, you can use `settings.jsdoc.structuredTags`
49
- to indicate that a tag's `name` is "namepath-defining" (and should prevent
50
- reporting on use of that namepath elsewhere) and/or that a tag's `type` is
51
- `false` (and should not be checked for types). If the `type` is an array, that
52
- array's items will be considered as defined for the purposes of that tag.
53
-
54
- <a name="user-content-no-undefined-types-options"></a>
55
- <a name="no-undefined-types-options"></a>
56
- ## Options
57
-
58
- An option object may have the following keys:
59
-
60
- - `definedTypes` - This array can be populated to indicate other types which
61
- are automatically considered as defined (in addition to globals, etc.).
62
- Defaults to an empty array.
63
- - `markVariablesAsUsed` - Whether to mark variables as used for the purposes
64
- of the `no-unused-vars` rule when they are not found to be undefined.
65
- Defaults to `true`. May be set to `false` to enforce a practice of not
66
- importing types unless used in code.
67
- - `disableReporting` - Whether to disable reporting of errors. Defaults to
68
- `false`. This may be set to `true` in order to take advantage of only
69
- marking defined variables as used.
70
-
71
- <a name="user-content-no-undefined-types-context-and-settings"></a>
72
- <a name="no-undefined-types-context-and-settings"></a>
73
- ## Context and settings
74
-
75
- |||
76
- |---|---|
77
- |Context|everywhere|
78
- |Tags|`augments`, `class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
79
- |Aliases|`constructor`, `const`, `extends`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
80
- |Closure-only|`package`, `private`, `protected`, `public`, `static`|
81
- |Recommended|true|
82
- |Options|`definedTypes`, `disableReporting`, `markVariablesAsUsed`|
83
- |Settings|`preferredTypes`, `mode`, `structuredTags`|
84
-
85
-
86
- <a name="user-content-no-undefined-types-failing-examples"></a>
87
- <a name="no-undefined-types-failing-examples"></a>
88
- ## Failing examples
89
-
90
- The following patterns are considered problems:
91
-
92
- ````js
93
- /**
94
- * @param {HerType} baz - Foo.
95
- */
96
- function quux(foo, bar, baz) {
97
-
98
- }
99
- // Settings: {"jsdoc":{"preferredTypes":{"HerType":1000}}}
100
- // Message: Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.
101
-
102
- /**
103
- * @param {HerType} baz - Foo.
104
- */
105
- function quux(foo, bar, baz) {
106
-
107
- }
108
- // Settings: {"jsdoc":{"preferredTypes":{"HerType":false}}}
109
- // Message: The type 'HerType' is undefined.
110
-
111
- /**
112
- * @param {strnig} foo - Bar.
113
- */
114
- function quux(foo) {
115
-
116
- }
117
- // Message: The type 'strnig' is undefined.
118
-
119
- /**
120
- * @param {MyType} foo - Bar.
121
- * @param {HisType} bar - Foo.
122
- */
123
- function quux(foo, bar) {
124
-
125
- }
126
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
127
- // Message: The type 'HisType' is undefined.
128
-
129
- /**
130
- * @param {MyType} foo - Bar.
131
- * @param {HisType} bar - Foo.
132
- * @param {HerType} baz - Foo.
133
- */
134
- function quux(foo, bar, baz) {
135
-
136
- }
137
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType"}}}}
138
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
139
- // Message: The type 'HisType' is undefined.
140
-
141
- /**
142
- * @param {MyType} foo - Bar.
143
- * @param {HisType} bar - Foo.
144
- * @param {HerType} baz - Foo.
145
- */
146
- function quux(foo, bar, baz) {
147
-
148
- }
149
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":false},"histype":"HisType"}}}
150
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
151
- // Message: The type 'HerType' is undefined.
152
-
153
- /**
154
- * @template TEMPLATE_TYPE
155
- * @param {WRONG_TEMPLATE_TYPE} bar
156
- */
157
- function foo (bar) {
158
- };
159
- // Settings: {"jsdoc":{"mode":"closure"}}
160
- // Message: The type 'WRONG_TEMPLATE_TYPE' is undefined.
161
-
162
- class Foo {
163
- /**
164
- * @return {TEMPLATE_TYPE}
165
- */
166
- bar () {
167
- }
168
- }
169
- // Message: The type 'TEMPLATE_TYPE' is undefined.
170
-
171
- class Foo {
172
- /**
173
- * @return {TEMPLATE_TYPE}
174
- */
175
- invalidTemplateReference () {
176
- }
177
- }
178
-
179
- /**
180
- * @template TEMPLATE_TYPE
181
- */
182
- class Bar {
183
- /**
184
- * @return {TEMPLATE_TYPE}
185
- */
186
- validTemplateReference () {
187
- }
188
- }
189
- // Settings: {"jsdoc":{"mode":"typescript"}}
190
- // Message: The type 'TEMPLATE_TYPE' is undefined.
191
-
192
- /**
193
- * @type {strnig}
194
- */
195
- var quux = {
196
-
197
- };
198
- // Message: The type 'strnig' is undefined.
199
-
200
- /**
201
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B
202
- */
203
- class Foo {
204
- /**
205
- * @param {TEMPLATE_TYPE_A} baz
206
- * @return {TEMPLATE_TYPE_B}
207
- */
208
- bar (baz) {
209
- }
210
- }
211
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
212
- // Message: The type 'TEMPLATE_TYPE_A' is undefined.
213
-
214
- /**
215
- * @param {...VAR_TYPE} varargs
216
- */
217
- function quux (varargs) {
218
- }
219
- // Message: The type 'VAR_TYPE' is undefined.
220
-
221
- /**
222
- * @this {Navigator}
223
- */
224
- function quux () {}
225
- // Settings: {"jsdoc":{"mode":"closure"}}
226
- // Message: The type 'Navigator' is undefined.
227
-
228
- /**
229
- * @export {SomeType}
230
- */
231
- function quux () {}
232
- // Settings: {"jsdoc":{"mode":"closure"}}
233
- // Message: The type 'SomeType' is undefined.
234
-
235
- /**
236
- * @aCustomTag {SomeType}
237
- */
238
- function quux () {}
239
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":true}}}}
240
- // Message: The type 'SomeType' is undefined.
241
-
242
- /**
243
- * @aCustomTag {SomeType}
244
- */
245
- function quux () {}
246
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["aType","anotherType"]}}}}
247
- // Message: The type 'SomeType' is undefined.
248
-
249
- /**
250
- * @namepathReferencing SomeType
251
- */
252
- /**
253
- * @type {SomeType}
254
- */
255
- // Settings: {"jsdoc":{"structuredTags":{"namepathReferencing":{"name":"namepath-referencing"}}}}
256
- // Message: The type 'SomeType' is undefined.
257
-
258
- /**
259
- * @template abc TEMPLATE_TYPE
260
- * @param {TEMPLATE_TYPE} bar
261
- */
262
- function foo (bar) {
263
- };
264
- // Settings: {"jsdoc":{"mode":"closure"}}
265
- // Message: The type 'TEMPLATE_TYPE' is undefined.
266
-
267
- /**
268
- * @suppress {visibility}
269
- */
270
- function foo () {
271
- }
272
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
273
- // Message: The type 'visibility' is undefined.
274
-
275
- /**
276
- * @typedef Todo
277
- * @property description
278
- * @property otherStuff
279
- */
280
- /**
281
- * @type {Omit<Todo, "description">}
282
- */
283
- const a = new Todo();
284
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
285
- // Message: The type 'Omit' is undefined.
286
-
287
- /**
288
- * Message with {@link NotKnown}
289
- */
290
- // Message: The type 'NotKnown' is undefined.
291
-
292
- /**
293
- * Message with
294
- * a link that is {@link NotKnown}
295
- */
296
- // Message: The type 'NotKnown' is undefined.
297
-
298
- /**
299
- * @abc
300
- * @someTag Message with
301
- * a link that is {@link NotKnown}
302
- */
303
- // Message: The type 'NotKnown' is undefined.
304
-
305
- /**
306
- * This is a {@namepathOrURLReferencer SomeType}.
307
- */
308
- // Settings: {"jsdoc":{"structuredTags":{"namepathOrURLReferencer":{"name":"namepath-or-url-referencing"}}}}
309
- // Message: The type 'SomeType' is undefined.
310
- ````
311
-
312
-
313
-
314
- <a name="user-content-no-undefined-types-passing-examples"></a>
315
- <a name="no-undefined-types-passing-examples"></a>
316
- ## Passing examples
317
-
318
- The following patterns are not considered problems:
319
-
320
- ````js
321
- /**
322
- * @param {string} foo - Bar.
323
- */
324
- function quux(foo) {
325
-
326
- }
327
-
328
- /**
329
- * @param {Promise} foo - Bar.
330
- */
331
- function quux(foo) {
332
-
333
- }
334
-
335
- class MyClass {}
336
-
337
- /**
338
- * @param {MyClass} foo - Bar.
339
- */
340
- function quux(foo) {
341
- console.log(foo);
342
- }
343
-
344
- quux(0);
345
-
346
- const MyType = require('my-library').MyType;
347
-
348
- /**
349
- * @param {MyType} foo - Bar.
350
- */
351
- function quux(foo) {
352
-
353
- }
354
-
355
- const MyType = require('my-library').MyType;
356
-
357
- /**
358
- * @param {MyType} foo - Bar.
359
- */
360
- function quux(foo) {
361
-
362
- }
363
-
364
- const MyType = require('my-library').MyType;
365
-
366
- /**
367
- * @param {MyType} foo - Bar.
368
- */
369
- function quux(foo) {
370
-
371
- }
372
-
373
- import {MyType} from 'my-library';
374
-
375
- /**
376
- * @param {MyType} foo - Bar.
377
- * @param {object<string, number>} foo
378
- * @param {Array<string>} baz
379
- */
380
- function quux(foo, bar, baz) {
381
-
382
- }
383
-
384
- /*globals MyType*/
385
-
386
- /**
387
- * @param {MyType} foo - Bar.
388
- * @param {HisType} bar - Foo.
389
- */
390
- function quux(foo, bar) {
391
-
392
- }
393
-
394
- /**
395
- * @typedef {object} hello
396
- * @property {string} a - a.
397
- */
398
-
399
- /**
400
- * @param {hello} foo
401
- */
402
- function quux(foo) {
403
-
404
- }
405
-
406
- /**
407
- * @param {Array<syntaxError} foo
408
- */
409
- function quux(foo) {
410
-
411
- }
412
-
413
- /**
414
- * Callback test.
415
- *
416
- * @callback addStuffCallback
417
- * @param {String} sum - An test integer.
418
- */
419
- /**
420
- * Test Eslint.
421
- *
422
- * @param {addStuffCallback} callback - A callback to run.
423
- */
424
- function testFunction(callback) {
425
- callback();
426
- }
427
-
428
- /**
429
- *
430
- *
431
- */
432
- function foo () {
433
-
434
- }
435
-
436
- /**
437
- * @param {MyType} foo - Bar.
438
- * @param {HisType} bar - Foo.
439
- */
440
- function quux(foo, bar) {
441
-
442
- }
443
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType","HisType"]}]
444
-
445
- /**
446
- * @param {MyType} foo - Bar.
447
- * @param {HisType} bar - Foo.
448
- * @param {HerType} baz - Foo.
449
- */
450
- function quux(foo, bar, baz) {
451
-
452
- }
453
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType"},"histype":"HisType"}}}
454
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
455
-
456
- /**
457
- * @param {MyType} foo - Bar.
458
- * @param {HisType} bar - Foo.
459
- * @param {HerType} baz - Foo.
460
- */
461
- function quux(foo, bar, baz) {
462
-
463
- }
464
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType<>"},"histype":"HisType.<>"}}}
465
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
466
-
467
- /**
468
- * @template TEMPLATE_TYPE
469
- * @param {TEMPLATE_TYPE} bar
470
- * @return {TEMPLATE_TYPE}
471
- */
472
- function foo (bar) {
473
- };
474
- // Settings: {"jsdoc":{"mode":"closure"}}
475
-
476
- /**
477
- * @template TEMPLATE_TYPE
478
- */
479
- class Foo {
480
- /**
481
- * @return {TEMPLATE_TYPE}
482
- */
483
- bar () {
484
- }
485
- }
486
- // Settings: {"jsdoc":{"mode":"closure"}}
487
-
488
- /**
489
- * @template TEMPLATE_TYPE
490
- */
491
- class Foo {
492
- /**
493
- * @return {TEMPLATE_TYPE}
494
- */
495
- bar () {}
496
-
497
- /**
498
- * @return {TEMPLATE_TYPE}
499
- */
500
- baz () {}
501
- }
502
- // Settings: {"jsdoc":{"mode":"closure"}}
503
-
504
- /**
505
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B
506
- */
507
- class Foo {
508
- /**
509
- * @param {TEMPLATE_TYPE_A} baz
510
- * @return {TEMPLATE_TYPE_B}
511
- */
512
- bar (baz) {
513
- }
514
- }
515
- // Settings: {"jsdoc":{"mode":"closure"}}
516
-
517
- /**
518
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B - Some description
519
- */
520
- class Foo {
521
- /**
522
- * @param {TEMPLATE_TYPE_A} baz
523
- * @return {TEMPLATE_TYPE_B}
524
- */
525
- bar (baz) {
526
- }
527
- }
528
- // Settings: {"jsdoc":{"mode":"closure"}}
529
-
530
- /****/
531
-
532
- /* */
533
-
534
- /*** */
535
-
536
- /**
537
- *
538
- */
539
- function quux () {
540
-
541
- }
542
-
543
- /**
544
- * @typedef {object} BaseObject
545
- */
546
- /**
547
- * Run callback when hooked method is called.
548
- *
549
- * @template {BaseObject} T
550
- * @param {T} obj - object whose method should be hooked.
551
- * @param {string} method - method which should be hooked.
552
- * @param {(sender: T) => void} callback - callback which should
553
- * be called when the hooked method was invoked.
554
- */
555
- function registerEvent(obj, method, callback) {
556
-
557
- }
558
- // Settings: {"jsdoc":{"mode":"typescript"}}
559
-
560
- /**
561
- * @param {...} varargs
562
- */
563
- function quux (varargs) {
564
- }
565
-
566
- /**
567
- * @param {...number} varargs
568
- */
569
- function quux (varargs) {
570
- }
571
-
572
- class Navigator {}
573
- /**
574
- * @this {Navigator}
575
- */
576
- function quux () {}
577
- // Settings: {"jsdoc":{"mode":"closure"}}
578
-
579
- class SomeType {}
580
- /**
581
- * @export {SomeType}
582
- */
583
- function quux () {}
584
- // Settings: {"jsdoc":{"mode":"closure"}}
585
-
586
- /**
587
- * @template T
588
- * @param {T} arg
589
- */
590
- function example(arg) {
591
-
592
- /** @param {T} */
593
- function inner(x) {
594
- }
595
- }
596
- // Settings: {"jsdoc":{"mode":"closure"}}
597
-
598
- const init = () => {
599
- /**
600
- * Makes request
601
- * @returns {Promise}
602
- */
603
- function request() {
604
- return Promise.resolve('success');
605
- }
606
- };
607
-
608
- /** Gets a Promise resolved with a given value.
609
- *
610
- * @template ValueType
611
- * @param {ValueType} value Value to resolve.
612
- * @returns {Promise<ValueType>} Promise resolved with value.
613
- */
614
- exports.resolve1 = function resolve1(value) {
615
- return Promise.resolve(value);
616
- };
617
- // Settings: {"jsdoc":{"mode":"typescript"}}
618
-
619
- /**
620
- * A function returning the same type as its argument.
621
- *
622
- * @template ValueType
623
- * @typedef {ValueType} ValueFunc
624
- */
625
- // Settings: {"jsdoc":{"mode":"typescript"}}
626
-
627
- /**
628
- * @aCustomTag {SomeType}
629
- */
630
- function quux () {}
631
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
632
-
633
- /**
634
- * @aCustomTag {SomeType}
635
- */
636
- function quux () {}
637
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["aType","SomeType"]}}}}
638
-
639
- /**
640
- * @namepathDefiner SomeType
641
- */
642
- /**
643
- * @type {SomeType}
644
- */
645
- // Settings: {"jsdoc":{"structuredTags":{"namepathDefiner":{"name":"namepath-defining"}}}}
646
-
647
- class Test {
648
- /**
649
- * Method.
650
- *
651
- * @returns {this} Return description.
652
- */
653
- method (): this {
654
- return this;
655
- }
656
- }
657
-
658
- /**
659
- * Bad types ignored here and handled instead by `valid-types`.
660
- * @param {string(} foo - Bar.
661
- */
662
- function quux(foo) {
663
-
664
- }
665
-
666
- /**
667
- * @template T
668
- * @param {T} arg
669
- * @returns {[T]}
670
- */
671
- function genericFunctionExample(arg) {
672
- const result = /** @type {[T]} */ (new Array());
673
- result[0] = arg;
674
- return result;
675
- }
676
- // Settings: {"jsdoc":{"mode":"closure"}}
677
-
678
- /** @typedef QDigestNode */
679
- class A {
680
- /**
681
- * @template {object} T
682
- * @param {(node: QDigestNode) => T} callback
683
- * @returns {T[]}
684
- */
685
- map(callback) {
686
- /** @type {T[]} */
687
- let vals;
688
- return vals;
689
- }
690
- }
691
- // Settings: {"jsdoc":{"mode":"typescript"}}
692
-
693
- /**
694
- * @template T
695
- * @param {T} arg
696
- */
697
- function example(arg) {
698
-
699
- /** @param {T} */
700
- function inner(x) {
701
- }
702
- }
703
- // Settings: {"jsdoc":{"mode":"typescript"}}
704
-
705
- /**
706
- * @suppress {visibility}
707
- */
708
- function foo () {
709
- }
710
- // Settings: {"jsdoc":{"mode":"closure"}}
711
-
712
- /**
713
- * @template T
714
- */
715
- export class Foo {
716
- // cast to T
717
- getType() {
718
- const x = "hello";
719
- const y = /** @type {T} */ (x);
720
- return y;
721
- }
722
- }
723
- // Settings: {"jsdoc":{"mode":"typescript"}}
724
-
725
- /**
726
- * @type {const}
727
- */
728
- const a = 'string';
729
-
730
- /**
731
- * @typedef Todo
732
- * @property description
733
- * @property otherStuff
734
- */
735
- /**
736
- * @type {Omit<Todo, "description">}
737
- */
738
- const a = new Todo();
739
- // Settings: {"jsdoc":{"mode":"typescript"}}
740
-
741
- /**
742
- * @template A, [B=SomeDefault]
743
- */
744
- class Foo {
745
- /**
746
- * @param {A} baz
747
- * @return {B}
748
- */
749
- bar (baz) {
750
- }
751
- }
752
- // Settings: {"jsdoc":{"mode":"typescript"}}
753
-
754
- import {MyType} from 'my-library';
755
-
756
- /**
757
- * @param {MyType} foo - Bar.
758
- * @param {AnUndefinedType} bar
759
- */
760
- function quux(foo, bar) {
761
-
762
- }
763
- // "jsdoc/no-undefined-types": ["error"|"warn", {"disableReporting":true}]
764
-
765
- class MyClass {}
766
- class AnotherClass {}
767
-
768
- /**
769
- * A description mentioning {@link MyClass} and {@link AnotherClass | another class} and a URL via [this link]{@link https://www.example.com}.
770
- */
771
- function quux(foo) {
772
- console.log(foo);
773
- }
774
-
775
- quux(0);
776
-
777
- class MyClass {}
778
- class AnotherClass {}
779
-
780
- /**
781
- * @see A tag mentioning {@link MyClass} and {@link AnotherClass | another class} and a URL via [this link]{@link https://www.example.com}.
782
- */
783
- function quux(foo) {
784
- console.log(foo);
785
- }
786
-
787
- quux(0);
788
- ````
789
-