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,881 +0,0 @@
1
- <a name="user-content-valid-types"></a>
2
- <a name="valid-types"></a>
3
- # <code>valid-types</code>
4
-
5
- * [Options](#user-content-valid-types-options)
6
- * [Context and settings](#user-content-valid-types-context-and-settings)
7
- * [Failing examples](#user-content-valid-types-failing-examples)
8
- * [Passing examples](#user-content-valid-types-passing-examples)
9
-
10
-
11
- Requires all types/namepaths to be valid JSDoc, Closure compiler, or
12
- TypeScript types (configured by `settings.jsdoc.mode`).
13
-
14
- Note that what determines a valid type is handled by
15
- our type parsing engine, [jsdoc-type-pratt-parser](https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser),
16
- using [`settings.jsdoc.mode`](#user-content-eslint-plugin-jsdoc-settings-mode) to
17
- determine whether to use jsdoc-type-pratt-parser's "permissive" parsing or
18
- the stricter "jsdoc", "typescript", "closure" modes.
19
-
20
- The following tags have their "type" portions (the segment within brackets)
21
- checked (though those portions may sometimes be confined to namepaths,
22
- e.g., `@modifies`):
23
-
24
- 1. Tags with required types: `@type`, `@implements`
25
- 1. Tags with required types in Closure or TypeScript: `@this`,
26
- `@define` (Closure only)
27
- 1. Tags with optional types: `@enum`, `@member` (`@var`), `@typedef`,
28
- `@augments` (or `@extends`), `@class` (or `@constructor`), `@constant`
29
- (or `@const`), `@module` (module paths are not planned for TypeScript),
30
- `@namespace`, `@throws`, `@exception`, `@yields` (or `@yield`),
31
- `@modifies` (undocumented jsdoc); `@param` (`@arg`, `@argument`),
32
- `@property` (`@prop`), and `@returns` (`@return`) also fall into this
33
- category, but while this rule will check their type validity, we leave
34
- the requiring of the type portion to the rules `require-param-type`,
35
- `require-property-type`, and `require-returns-type`, respectively.
36
- 1. Tags with types that are available optionally in Closure: `@export`,
37
- `@package`, `@private`, `@protected`, `@public`, `@static`;
38
- `@template` (TypeScript also)
39
- 1. Tags with optional types that may take free text instead: `@throws`
40
-
41
- The following tags have their name/namepath portion (the non-whitespace
42
- text after the tag name) checked:
43
-
44
- 1. Name(path)-defining tags requiring namepath: `@event`, `@callback`,
45
- `@exports` (JSDoc only),
46
- `@external`, `@host`, `@name`, `@typedef` (JSDoc only), and `@template`
47
- (TypeScript/Closure only); `@param` (`@arg`, `@argument`) and `@property`
48
- (`@prop`) also fall into this category, but while this rule will check
49
- their namepath validity, we leave the requiring of the name portion
50
- to the rules `require-param-name` and `require-property-name`,
51
- respectively.
52
- 1. Name(path)-defining tags (which may have value without namepath or their
53
- namepath can be expressed elsewhere on the block):
54
- `@class`, `@constructor`, `@constant`, `@const`, `@function`, `@func`,
55
- `@method`, `@interface` (non-Closure only), `@member`, `@var`,
56
- `@mixin`, `@namespace`, `@module` (module paths are not planned for
57
- TypeScript)
58
- 1. Name(path)-pointing tags requiring namepath: `@alias`, `@augments`,
59
- `@extends` (JSDoc only), `@lends`, `@memberof`, `@memberof!`, `@mixes`, `@requires`, `@this`
60
- (jsdoc only)
61
- 1. Name(path)-pointing tags (which may have value without namepath or their
62
- namepath can be expressed elsewhere on the block): `@listens`, `@fires`,
63
- `@emits`.
64
- 1. Name(path)-pointing tags which may have free text or a namepath: `@see`
65
- 1. Name(path)-pointing tags (multiple names in one): `@borrows`
66
-
67
- ...with the following applying to the above sets:
68
-
69
- - Expect tags in set 1-4 to have a valid namepath if present
70
- - Prevent sets 2 and 4 from being empty by setting `allowEmptyNamepaths` to
71
- `false` as these tags might have some indicative value without a path
72
- or may allow a name expressed elsewhere on the block (but sets 1 and 3 will
73
- always fail if empty)
74
- - For the special case of set 6, i.e.,
75
- `@borrows <that namepath> as <this namepath>`,
76
- check that both namepaths are present and valid and ensure there is an `as `
77
- between them. In the case of `<this namepath>`, it can be preceded by
78
- one of the name path operators, `#`, `.`, or `~`.
79
- - For the special case of `@memberof` and `@memberof!` (part of set 3), as
80
- per the [specification](https://jsdoc.app/tags-memberof.html), they also
81
- allow `#`, `.`, or `~` at the end (which is not allowed at the end of
82
- normal paths).
83
-
84
- If you define your own tags, `settings.jsdoc.structuredTags` will allow
85
- these custom tags to be checked, with the name portion of tags checked for
86
- valid namepaths (based on the tag's `name` value), their type portions checked
87
- for valid types (based on the tag's `type` value), and either portion checked
88
- for presence (based on `false` `name` or `type` values or their `required`
89
- value). See the setting for more details.
90
-
91
- <a name="user-content-valid-types-options"></a>
92
- <a name="valid-types-options"></a>
93
- ## Options
94
-
95
- - `allowEmptyNamepaths` (default: true) - Set to `false` to bulk disallow
96
- empty name paths with namepath groups 2 and 4 (these might often be
97
- expected to have an accompanying name path, though they have some
98
- indicative value without one; these may also allow names to be defined
99
- in another manner elsewhere in the block); you can use
100
- `settings.jsdoc.structuredTags` with the `required` key set to "name" if you
101
- wish to require name paths on a tag-by-tag basis.
102
-
103
- <a name="user-content-valid-types-context-and-settings"></a>
104
- <a name="valid-types-context-and-settings"></a>
105
- ## Context and settings
106
-
107
- |||
108
- |---|---|
109
- |Context|everywhere|
110
- |Tags|For name only unless otherwise stated: `alias`, `augments`, `borrows`, `callback`, `class` (for name and type), `constant` (for name and type), `enum` (for type), `event`, `external`, `fires`, `function`, `implements` (for type), `interface`, `lends`, `listens`, `member` (for name and type), `memberof`, `memberof!`, `mixes`, `mixin`, `modifies`, `module` (for name and type), `name`, `namespace` (for name and type), `param` (for name and type), `property` (for name and type), `returns` (for type), `see` (optionally for name), `this`, `throws` (for type), `type` (for type), `typedef` (for name and type), `yields` (for type)|
111
- |Aliases|`extends`, `constructor`, `const`, `host`, `emits`, `func`, `method`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
112
- |Closure-only|For type only: `package`, `private`, `protected`, `public`, `static`|
113
- |Recommended|true|
114
- |Options|`allowEmptyNamepaths`|
115
- |Settings|`mode`, `structuredTags`|
116
-
117
- <a name="user-content-valid-types-failing-examples"></a>
118
- <a name="valid-types-failing-examples"></a>
119
- ## Failing examples
120
-
121
- The following patterns are considered problems:
122
-
123
- ````js
124
- /**
125
- * @param {Array<string} foo
126
- */
127
- function quux() {
128
-
129
- }
130
- // Message: Syntax error in type: Array<string
131
-
132
- /**
133
- * @memberof module:namespace.SomeClass<~
134
- */
135
- function quux() {
136
-
137
- }
138
- // Message: Syntax error in namepath: module:namespace.SomeClass<~
139
-
140
- /**
141
- * @param someParam<~
142
- */
143
- function quux() {
144
-
145
- }
146
- // Message: Syntax error in namepath: someParam<~
147
-
148
- /**
149
- * @memberof module:namespace.SomeClass~<
150
- */
151
- function quux() {
152
-
153
- }
154
- // Message: Syntax error in namepath: module:namespace.SomeClass~<
155
-
156
- /**
157
- * @borrows foo% as bar
158
- */
159
- function quux() {
160
-
161
- }
162
- // Message: Syntax error in namepath: foo%
163
-
164
- /**
165
- * @borrows #foo as bar
166
- */
167
- function quux() {
168
-
169
- }
170
- // Message: Syntax error in namepath: #foo
171
-
172
- /**
173
- * @borrows foo as bar%
174
- */
175
- function quux() {
176
-
177
- }
178
- // Message: Syntax error in namepath: bar%
179
-
180
- /**
181
- * @borrows foo
182
- */
183
- function quux() {
184
-
185
- }
186
- // Message: @borrows must have an "as" expression. Found ""
187
-
188
- /**
189
- * @see foo%
190
- */
191
- function quux() {
192
-
193
- }
194
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing","required":["name"]}}}}
195
- // Message: Syntax error in namepath: foo%
196
-
197
- /**
198
- * @mixes module:namespace.SomeClass~
199
- */
200
- function quux() {
201
-
202
- }
203
- // Message: Syntax error in namepath: module:namespace.SomeClass~
204
-
205
- /**
206
- * @callback
207
- */
208
- function quux() {
209
-
210
- }
211
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
212
- // Message: Tag @callback must have a name/namepath.
213
-
214
- /**
215
- * @constant {str%ng}
216
- */
217
- const FOO = 'foo';
218
- // Message: Syntax error in type: str%ng
219
-
220
- /**
221
- * @typedef {str%ng} UserString
222
- */
223
- // Message: Syntax error in type: str%ng
224
-
225
- /**
226
- * @typedef {string} UserStr%ng
227
- */
228
- // Message: Syntax error in namepath: UserStr%ng
229
-
230
- /**
231
- * @this
232
- */
233
- class Bar {};
234
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
235
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
236
- // Message: Tag @this must have either a type or namepath in "jsdoc" mode.
237
-
238
- /**
239
- * @aCustomTag
240
- */
241
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"required":["typeOrNameRequired"]}}}}
242
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
243
- // Message: Tag @aCustomTag must have either a type or namepath.
244
-
245
- /**
246
- * @type
247
- */
248
- let foo;
249
- // Message: Tag @type must have a type.
250
-
251
- /**
252
- * @modifies {bar | foo<}
253
- */
254
- function quux (foo, bar, baz) {}
255
- // Message: Syntax error in type: bar | foo<
256
-
257
- /**
258
- * @private {BadTypeChecked<}
259
- */
260
- function quux () {}
261
- // Settings: {"jsdoc":{"mode":"closure"}}
262
- // Message: Syntax error in type: BadTypeChecked<
263
-
264
- /**
265
- * @this {BadTypeChecked<}
266
- */
267
- function quux () {}
268
- // Settings: {"jsdoc":{"mode":"closure"}}
269
- // Message: Syntax error in type: BadTypeChecked<
270
-
271
- /**
272
- * @define
273
- */
274
- function quux () {}
275
- // Settings: {"jsdoc":{"mode":"closure"}}
276
- // Message: Tag @define must have a type in "closure" mode.
277
-
278
- /**
279
- * @this
280
- */
281
- let foo;
282
- // Settings: {"jsdoc":{"mode":"closure"}}
283
- // Message: Tag @this must have a type in "closure" mode.
284
-
285
- /**
286
- * Foo function.
287
- *
288
- * @param {[number, string]} bar - The bar array.
289
- */
290
- function foo(bar) {}
291
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
292
- // Message: Syntax error in type: [number, string]
293
-
294
- /**
295
- * @interface name<
296
- */
297
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
298
- // Message: Syntax error in namepath: name<
299
-
300
- /**
301
- * @module name<
302
- */
303
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
304
- // Message: Syntax error in namepath: name<
305
-
306
- /**
307
- * @module module:name<
308
- */
309
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
310
- // Message: Syntax error in namepath: module:name<
311
-
312
- /**
313
- * @interface name
314
- */
315
- // Settings: {"jsdoc":{"mode":"closure"}}
316
- // Message: @interface should not have a name in "closure" mode.
317
-
318
- /**
319
- * @aCustomTag name
320
- */
321
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"name":false}}}}
322
- // Message: @aCustomTag should not have a name.
323
-
324
- /**
325
- * @typedef {SomeType}
326
- */
327
- function quux () {}
328
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
329
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
330
- // Message: Tag @typedef must have a name/namepath in "jsdoc" mode.
331
-
332
- /**
333
- * @private {SomeType}
334
- */
335
- function quux () {}
336
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
337
- // Message: @private should not have a bracketed type in "jsdoc" mode.
338
-
339
- /**
340
- * @aCustomTag {SomeType}
341
- */
342
- function quux () {}
343
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
344
- // Message: @aCustomTag should not have a bracketed type.
345
-
346
- /**
347
- * @see foo%
348
- */
349
- function quux() {
350
-
351
- }
352
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
353
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
354
-
355
- /**
356
- * @see foo%
357
- */
358
- function quux() {
359
-
360
- }
361
- // Settings: {"jsdoc":{"structuredTags":{"see":{"required":["type"],"type":false}}}}
362
- // Message: Cannot add "type" to `require` with the tag's `type` set to `false`
363
-
364
- /**
365
- * @see foo%
366
- */
367
- function quux() {
368
-
369
- }
370
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["typeOrNameRequired"]}}}}
371
- // Message: Cannot add "typeOrNameRequired" to `require` with the tag's `name` set to `false`
372
-
373
- /**
374
- * @see foo%
375
- */
376
- function quux() {
377
-
378
- }
379
- // Settings: {"jsdoc":{"structuredTags":{"see":{"required":["typeOrNameRequired"],"type":false}}}}
380
- // Message: Cannot add "typeOrNameRequired" to `require` with the tag's `type` set to `false`
381
-
382
- /**
383
- * @template T<~, R
384
- * @param {function(!T): !R} parser
385
- * @return {function(!Array<!T>): !Array<!R>}
386
- */
387
- parseArray = function(parser) {
388
- return function(array) {
389
- return array.map(parser);
390
- };
391
- };
392
- // Settings: {"jsdoc":{"mode":"closure"}}
393
- // Message: Syntax error in namepath: T<~
394
-
395
- /**
396
- * @template T, R<~
397
- * @param {function(!T): !R} parser
398
- * @return {function(!Array<!T>): !Array<!R>}
399
- */
400
- parseArray = function(parser) {
401
- return function(array) {
402
- return array.map(parser);
403
- };
404
- };
405
- // Settings: {"jsdoc":{"mode":"closure"}}
406
- // Message: Syntax error in namepath: R<~
407
-
408
- /**
409
- * @template T, R<~
410
- * @param {function(!T): !R} parser
411
- * @return {function(!Array<!T>): !Array<!R>}
412
- */
413
- parseArray = function(parser) {
414
- return function(array) {
415
- return array.map(parser);
416
- };
417
- };
418
- // Settings: {"jsdoc":{"mode":"closure"}}
419
- // Message: Syntax error in namepath: R<~
420
-
421
- /**
422
- * @suppress
423
- */
424
- function quux () {}
425
- // Settings: {"jsdoc":{"mode":"closure"}}
426
- // Message: Tag @suppress must have a type in "closure" mode.
427
-
428
- /**
429
- * @suppress {visibility} sth
430
- */
431
- function quux () {}
432
- // Settings: {"jsdoc":{"mode":"closure"}}
433
- // Message: @suppress should not have a name in "closure" mode.
434
-
435
- /**
436
- * @suppress {visibility|blah}
437
- */
438
- function quux () {}
439
- // Settings: {"jsdoc":{"mode":"closure"}}
440
- // Message: Syntax error in suppress type: blah
441
-
442
- /**
443
- * @param {Object[]} employees
444
- * @param {string} employees[.name - The name of an employee.
445
- */
446
- function quux () {}
447
- // Message: Invalid name: unpaired brackets
448
-
449
- /**
450
- * @param {Object[]} employees
451
- * @param {string} [] - The name of an employee.
452
- */
453
- function quux () {}
454
- // Message: Invalid name: empty name
455
-
456
- /**
457
- * @param {Object[]} employees
458
- * @param {string} [] - The name of an employee.
459
- */
460
- function quux () {}
461
- // Message: Invalid name: empty name
462
-
463
- /**
464
- * @param {string} [name=] - The name of an employee.
465
- */
466
- function quux () {}
467
- // Message: Invalid name: empty default value
468
-
469
- /**
470
- * @param {string} [name==] - The name of an employee.
471
- */
472
- function quux () {}
473
- // Message: Invalid name: invalid default value syntax
474
-
475
- /**
476
- * @type {{message: string?}}
477
- */
478
- function quux (items) {
479
- }
480
- // Settings: {"jsdoc":{"mode":"closure"}}
481
- // Message: Syntax error in type: JsdocTypeNullable
482
-
483
- /**
484
- * @type {[message: string?]}
485
- */
486
- function quux (items) {
487
- }
488
- // Settings: {"jsdoc":{"mode":"typescript"}}
489
- // Message: Syntax error in type: JsdocTypeNullable
490
-
491
- /**
492
- * An inline {@link} tag without content.
493
- */
494
- // Message: Inline tag "link" missing content
495
-
496
- /**
497
- * An inline {@tutorial} tag without content.
498
- */
499
- // Message: Inline tag "tutorial" missing content
500
-
501
- /**
502
- * @param {SomeType} aName An inline {@link} tag without content.
503
- */
504
- // Message: Inline tag "link" missing content
505
- ````
506
-
507
-
508
-
509
- <a name="user-content-valid-types-passing-examples"></a>
510
- <a name="valid-types-passing-examples"></a>
511
- ## Passing examples
512
-
513
- The following patterns are not considered problems:
514
-
515
- ````js
516
- /**
517
- * @param {Array<string>} foo
518
- */
519
- function quux() {
520
-
521
- }
522
-
523
- /**
524
- * @param {string} foo
525
- */
526
- function quux() {
527
-
528
- }
529
-
530
- /**
531
- * @param foo
532
- */
533
- function quux() {
534
-
535
- }
536
-
537
- /**
538
- * @borrows foo as bar
539
- */
540
- function quux() {
541
-
542
- }
543
-
544
- /**
545
- * @borrows foo as #bar
546
- */
547
- function quux() {
548
-
549
- }
550
-
551
- /**
552
- * @see foo%
553
- */
554
- function quux() {
555
-
556
- }
557
-
558
- /**
559
- * @alias module:namespace.SomeClass#event:ext_anevent
560
- */
561
- function quux() {
562
-
563
- }
564
-
565
- /**
566
- * @callback foo
567
- */
568
- function quux() {
569
-
570
- }
571
-
572
- /**
573
- * @callback
574
- */
575
- function quux() {
576
-
577
- }
578
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":true}]
579
-
580
- /**
581
- * @class
582
- */
583
- function quux() {
584
-
585
- }
586
-
587
- /**
588
- * @see {@link foo}
589
- */
590
- function quux() {
591
-
592
- }
593
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing","required":["name"]}}}}
594
-
595
- /**
596
- *
597
- * @fires module:namespace.SomeClass#event:ext_anevent
598
- */
599
- function quux() {
600
-
601
- }
602
-
603
- /**
604
- * @memberof module:namespace.SomeClass~
605
- */
606
- function quux() {
607
-
608
- }
609
-
610
- /**
611
- * @memberof! module:namespace.SomeClass.
612
- */
613
- function quux() {
614
-
615
- }
616
-
617
- /**
618
- *
619
- */
620
- function quux() {
621
-
622
- }
623
-
624
- /**
625
- * @aCustomTag
626
- */
627
- function quux() {
628
-
629
- }
630
-
631
- /**
632
- * @constant {string}
633
- */
634
- const FOO = 'foo';
635
-
636
- /**
637
- * @constant {string} FOO
638
- */
639
- const FOO = 'foo';
640
-
641
- /**
642
- * @extends Foo
643
- */
644
- class Bar {};
645
-
646
- /**
647
- * @extends Foo<String>
648
- */
649
- class Bar {};
650
-
651
- /**
652
- * @extends {Foo<String>}
653
- */
654
- class Bar {};
655
- // Settings: {"jsdoc":{"mode":"closure"}}
656
-
657
- /**
658
- * @typedef {number | string} UserDefinedType
659
- */
660
-
661
- /**
662
- * @typedef {number | string}
663
- */
664
- let UserDefinedGCCType;
665
- // Settings: {"jsdoc":{"mode":"closure"}}
666
-
667
- /**
668
- * @modifies {foo | bar}
669
- */
670
- function quux (foo, bar, baz) {}
671
-
672
- /**
673
- * @this {Navigator}
674
- */
675
- function quux () {}
676
- // Settings: {"jsdoc":{"mode":"closure"}}
677
-
678
- /**
679
- * @export {SomeType}
680
- */
681
- function quux () {}
682
- // Settings: {"jsdoc":{"mode":"closure"}}
683
-
684
- /**
685
- * @define {boolean}
686
- */
687
- function quux () {}
688
- // Settings: {"jsdoc":{"mode":"closure"}}
689
-
690
- /**
691
- * @define
692
- */
693
- function quux () {}
694
-
695
- /**
696
- * Foo function.
697
- *
698
- * @interface foo
699
- */
700
- function foo(bar) {}
701
- // Settings: {"jsdoc":{"mode":"typescript"}}
702
-
703
- /**
704
- * Foo function.
705
- *
706
- * @param {[number, string]} bar - The bar array.
707
- */
708
- function foo(bar) {}
709
- // Settings: {"jsdoc":{"mode":"typescript"}}
710
-
711
- /**
712
- * Foo function.
713
- *
714
- * @param {[number, string]} bar - The bar array.
715
- */
716
- function foo(bar) {}
717
-
718
- /**
719
- * Foo function.
720
- *
721
- * @param {[number, string]} bar - The bar array.
722
- */
723
- function foo(bar) {}
724
- // Settings: {"jsdoc":{"mode":"permissive"}}
725
-
726
- /**
727
- * @typedef {SomeType}
728
- */
729
- function quux () {}
730
- // Settings: {"jsdoc":{"mode":"closure"}}
731
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
732
-
733
- /**
734
- * @private {SomeType}
735
- */
736
- function quux () {}
737
- // Settings: {"jsdoc":{"mode":"closure"}}
738
-
739
- /**
740
- * @param
741
- */
742
- function quux() {
743
-
744
- }
745
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
746
-
747
- /**
748
- * @see
749
- */
750
- function quux() {
751
-
752
- }
753
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing"}}}}
754
-
755
- /**
756
- * @template T, R
757
- * @param {function(!T): !R} parser
758
- * @return {function(!Array<!T>): !Array<!R>}
759
- */
760
- parseArray = function(parser) {
761
- return function(array) {
762
- return array.map(parser);
763
- };
764
- };
765
- // Settings: {"jsdoc":{"mode":"closure"}}
766
-
767
- /**
768
- * @template T, R<~
769
- * @param {function(!T): !R} parser
770
- * @return {function(!Array<!T>): !Array<!R>}
771
- */
772
- parseArray = function(parser) {
773
- return function(array) {
774
- return array.map(parser);
775
- };
776
- };
777
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
778
-
779
- /**
780
- * @template {string} K - K must be a string or string literal
781
- * @template {{ serious: string }} Seriousalizable - must have a serious property
782
- * @param {K} key
783
- * @param {Seriousalizable} object
784
- */
785
- function seriousalize(key, object) {
786
- // ????
787
- }
788
- // Settings: {"jsdoc":{"mode":"typescript"}}
789
-
790
- /**
791
- * @module foo/bar
792
- */
793
-
794
- /**
795
- * @module module:foo/bar
796
- */
797
-
798
- /**
799
- * @template invalid namepath,T Description
800
- */
801
- function f() {}
802
- // Settings: {"jsdoc":{"mode":"closure"}}
803
-
804
- /**
805
- * Description of complicated type.
806
- *
807
- * @template T Description of the T type parameter.
808
- * @template U - Like other tags, this can have an optional hyphen before the description.
809
- * @template V,W More parameters
810
- * @template W,X - Also with a hyphen
811
- */
812
- type ComplicatedType<T, U, V, W, X> = never
813
-
814
- /** Multi-line typedef for an options object type.
815
- *
816
- * @typedef {{
817
- * prop: number
818
- * }} MyOptions
819
- */
820
-
821
- /**
822
- * @extends {SomeType}
823
- */
824
- class quux {}
825
- // Settings: {"jsdoc":{"mode":"typescript"}}
826
-
827
- /**
828
- * @suppress {visibility|underscore}
829
- */
830
- function quux() {
831
- }
832
- // Settings: {"jsdoc":{"mode":"closure"}}
833
-
834
- /**
835
- * @param {string} id
836
- * @param {Object} options
837
- * @param {boolean} options.isSet
838
- * @param {string} options.module
839
- */
840
- function quux ( id, options ) {
841
- }
842
-
843
-
844
- /**
845
- * Assign the project to a list of employees.
846
- * @param {Object[]} employees - The employees who are responsible for the project.
847
- * @param {string} employees[].name - The name of an employee.
848
- * @param {string} employees[].department - The employee's department.
849
- */
850
- function assign(employees) {
851
- // ...
852
- }
853
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":true}]
854
-
855
- /**
856
- * @param {typeof obj["level1"]["level2"]} foo
857
- * @param {Parameters<testFunc>[0]} ghi
858
- * @param {{[key: string]: string}} hjk
859
- */
860
- function quux() {
861
-
862
- }
863
- // Settings: {"jsdoc":{"mode":"typescript"}}
864
-
865
- /**
866
- * @returns {Promise<{publicKey, privateKey}>} - The public and private key
867
- */
868
-
869
- /**
870
- * Some other {@inline} tag.
871
- */
872
-
873
- /**
874
- * @param {SomeType} aName An inline {@link text} tag with content.
875
- */
876
-
877
- /**
878
- * An inline {@link text} tag with content.
879
- */
880
- ````
881
-