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,1198 +0,0 @@
1
- <a name="user-content-check-types"></a>
2
- <a name="check-types"></a>
3
- # <code>check-types</code>
4
-
5
- * [Options](#user-content-check-types-options)
6
- * [Why not capital case everything?](#user-content-check-types-why-not-capital-case-everything)
7
- * [Comparisons](#user-content-check-types-comparisons)
8
- * [Fixer](#user-content-check-types-fixer)
9
- * [Context and settings](#user-content-check-types-context-and-settings)
10
- * [Failing examples](#user-content-check-types-failing-examples)
11
- * [Passing examples](#user-content-check-types-passing-examples)
12
-
13
-
14
- Reports invalid types.
15
-
16
- By default, ensures that the casing of native types is the same as in this
17
- list:
18
-
19
- ```
20
- undefined
21
- null
22
- boolean
23
- number
24
- bigint
25
- string
26
- symbol
27
- object (For TypeScript's sake, however, using `Object` when specifying child types on it like `Object<string, number>`)
28
- Array
29
- Function
30
- Date
31
- RegExp
32
- ```
33
-
34
- <a name="user-content-check-types-options"></a>
35
- <a name="check-types-options"></a>
36
- ## Options
37
-
38
- `check-types` allows one option:
39
-
40
- - An option object:
41
- - with the key `noDefaults` to insist that only the supplied option type
42
- map is to be used, and that the default preferences (such as "string"
43
- over "String") will not be enforced. The option's default is `false`.
44
- - with the key `exemptTagContexts` which will avoid reporting when a
45
- bad type is found on a specified tag. Set to an array of objects with
46
- a key `tag` set to the tag to exempt, and a `types` key which can
47
- either be `true` to indicate that any types on that tag will be allowed,
48
- or to an array of strings which will only allow specific bad types.
49
- If an array of strings is given, these must match the type exactly,
50
- e.g., if you only allow `"object"`, it will not allow
51
- `"object<string, string>"`. Note that this is different from the
52
- behavior of `settings.jsdoc.preferredTypes`. This option is useful
53
- for normally restricting generic types like `object` with
54
- `preferredTypes`, but allowing `typedef` to indicate that its base
55
- type is `object`.
56
- - with the key `unifyParentAndChildTypeChecks` which will treat
57
- `settings.jsdoc.preferredTypes` keys such as `SomeType` as matching
58
- not only child types such as an unadorned `SomeType` but also
59
- `SomeType<aChildType>` and `SomeType.<aChildType>` (and if the type is
60
- instead `Array` (or `[]`), it will match `aChildType[]`). If this
61
- option is `false` or
62
- unset, the former format will only apply to types which are not parent
63
- types/unions whereas the latter formats will only apply for parent
64
- types/unions. The special types `[]`, `.<>` (or `.`), and `<>`
65
- act only as parent types (and will not match a bare child type such as
66
- `Array` even when unified, though, as mentioned, `Array` will match
67
- say `string[]` or `Array.<string>` when unified). The special type
68
- `*` is only a child type. Note that there is no detection of parent
69
- and child type together, e.g., you cannot specify preferences for
70
- `string[]` specifically as distinct from say `number[]`, but you can
71
- target both with `[]` or the child types `number` or `string`.
72
-
73
- If a value is present both as a key and as a value, neither the key nor the
74
- value will be reported. Thus one can use this fact to allow both `object`
75
- and `Object`, for example. Note that in "typescript" mode, this is the default
76
- behavior.
77
-
78
- See also the documentation on `settings.jsdoc.preferredTypes` which impacts
79
- the behavior of `check-types`.
80
-
81
- Note that if there is an error [parsing](https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser)
82
- types for a tag, the function will silently ignore that tag, leaving it to
83
- the `valid-types` rule to report parsing errors.
84
-
85
- <a name="user-content-check-types-why-not-capital-case-everything"></a>
86
- <a name="check-types-why-not-capital-case-everything"></a>
87
- ## Why not capital case everything?
88
-
89
- Why are `boolean`, `number` and `string` exempt from starting with a capital
90
- letter? Let's take `string` as an example. In Javascript, everything is an
91
- object. The `String` object has prototypes for string functions such as
92
- `.toUpperCase()`.
93
-
94
- Fortunately we don't have to write `new String()` everywhere in our code.
95
- Javascript will automatically wrap string primitives into string Objects when
96
- we're applying a string function to a string primitive. This way the memory
97
- footprint is a tiny little bit smaller, and the
98
- [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has
99
- less work to do.
100
-
101
- So in a sense, there are two types of strings in Javascript:
102
- 1. `{string}` literals, also called primitives
103
- 2. `{String}` Objects.
104
-
105
- We use the primitives because it's easier to write and uses less memory.
106
- `{String}` and `{string}` are technically both valid, but they are not the same.
107
-
108
- ```js
109
- new String('lard') // String {0: "l", 1: "a", 2: "r", 3: "d", length: 4}
110
- 'lard' // "lard"
111
- new String('lard') === 'lard' // false
112
- ```
113
-
114
- To make things more confusing, there are also object literals (like `{}`) and
115
- `Object` objects. But object literals are still static `Object`s and `Object`
116
- objects are instantiated objects. So an object primitive is still an `Object`
117
- object.
118
-
119
- However, `Object.create(null)` objects are not `instanceof Object`, however, so
120
- in the case of such a plain object we lower-case to indicate possible support
121
- for these objects. Also, nowadays, TypeScript also [discourages](https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#:~:text=%E2%9D%8C%20Don't%20ever%20use,used%20appropriately%20in%20JavaScript%20code.)
122
- use of `Object`
123
- as a lone type. However, one additional complexity is that TypeScript allows and
124
- actually [currently requires](https://github.com/microsoft/TypeScript/issues/20555)
125
- `Object` (with the initial upper-case) if used in the syntax
126
- `Object.<keyType, valueType>` or `Object<keyType, valueType`, perhaps to
127
- adhere to that which [JSDoc documents](https://jsdoc.app/tags-type.html).
128
-
129
- So, for optimal compatibility with TypeScript (especially since TypeScript
130
- tools can be used on plain JavaScript with JSDoc), we are now requiring this
131
- TypeScript approach by default in non-"typescript" mode (if you set
132
- `object` type `preferredTypes` in TypeScript mode, the defaults will
133
- not apply).
134
-
135
- However, for "typescript" mode, a still better choice exists—using index signatures such as `{[key: string]: string}` or using a more precise
136
- shorthand object syntax (e.g., `{a: string, b: number}`). This is superior
137
- for TypeScript because the likes of `Object<string, number>` is not useable
138
- in native TypeScript syntax, even if it is allowed within JSDoc.
139
-
140
- Basically, for primitives, we want to define the type as a primitive, because
141
- that's what we use in 99.9% of cases. For everything else, we use the type
142
- rather than the primitive. Otherwise it would all just be `{object}` (with the
143
- additional exception of the special case of `Object.<>` just mentioned).
144
-
145
- In short: It's not about consistency, rather about the 99.9% use case. (And
146
- some functions might not even support the objects if they are checking for
147
- identity.)
148
-
149
- <a name="user-content-check-types-comparisons"></a>
150
- <a name="check-types-comparisons"></a>
151
- ## Comparisons
152
-
153
- type name | `typeof` | check-types | testcase
154
- --|--|--|--
155
- **Array** | object | **Array** | `([]) instanceof Array` -> `true`
156
- **Function** | function | **Function** | `(function f () {}) instanceof Function` -> `true`
157
- **Date** | object | **Date** | `(new Date()) instanceof Date` -> `true`
158
- **RegExp** | object | **RegExp** | `(new RegExp(/.+/)) instanceof RegExp` -> `true`
159
- Object | **object** | **object** | `({}) instanceof Object` -> `true` but `Object.create(null) instanceof Object` -> `false`
160
- Boolean | **boolean** | **boolean** | `(true) instanceof Boolean` -> **`false`**
161
- Number | **number** | **number** | `(41) instanceof Number` -> **`false`**
162
- String | **string** | **string** | `("test") instanceof String` -> **`false`**
163
-
164
- If you define your own tags and don't wish their bracketed portions checked
165
- for types, you can use `settings.jsdoc.structuredTags` with a tag `type` of
166
- `false`. If you set their `type` to an array, only those values will be
167
- permitted.
168
-
169
- <a name="user-content-check-types-fixer"></a>
170
- <a name="check-types-fixer"></a>
171
- ## Fixer
172
-
173
- (Todo)
174
-
175
- <a name="user-content-check-types-context-and-settings"></a>
176
- <a name="check-types-context-and-settings"></a>
177
- ## Context and settings
178
-
179
- |||
180
- |---|---|
181
- |Context|everywhere|
182
- |Tags|`augments`, `class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
183
- |Aliases|`constructor`, `const`, `extends`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
184
- |Closure-only|`package`, `private`, `protected`, `public`, `static`|
185
- |Recommended|true|
186
- |Options|`exemptTagContexts`, `noDefaults`, `unifyParentAndChildTypeChecks`|
187
- |Settings|`preferredTypes`, `mode`, `structuredTags`|
188
-
189
- <a name="user-content-check-types-failing-examples"></a>
190
- <a name="check-types-failing-examples"></a>
191
- ## Failing examples
192
-
193
- The following patterns are considered problems:
194
-
195
- ````js
196
- /**
197
- * @param {abc} foo
198
- */
199
- function quux (foo) {
200
-
201
- }
202
- // Settings: {"jsdoc":{"preferredTypes":{"abc":100}}}
203
- // Message: Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.
204
-
205
- /**
206
- * @param {Number} foo
207
- */
208
- function quux (foo) {
209
-
210
- }
211
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
212
-
213
- /**
214
- * @arg {Number} foo
215
- */
216
- function quux (foo) {
217
-
218
- }
219
- // Message: Invalid JSDoc @arg "foo" type "Number"; prefer: "number".
220
-
221
- /**
222
- * @returns {Number} foo
223
- * @throws {Number} foo
224
- */
225
- function quux () {
226
-
227
- }
228
- // Message: Invalid JSDoc @returns type "Number"; prefer: "number".
229
-
230
- /**
231
- * @param {(Number | string | Boolean)=} foo
232
- */
233
- function quux (foo, bar, baz) {
234
-
235
- }
236
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
237
-
238
- /**
239
- * @param {Array.<Number | String>} foo
240
- */
241
- function quux (foo, bar, baz) {
242
-
243
- }
244
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
245
-
246
- /**
247
- * @param {(Number | String)[]} foo
248
- */
249
- function quux (foo, bar, baz) {
250
-
251
- }
252
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
253
-
254
- /**
255
- * @param {abc} foo
256
- */
257
- function qux(foo) {
258
- }
259
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
260
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
261
-
262
- /**
263
- * @param {abc} foo
264
- */
265
- function qux(foo) {
266
- }
267
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"replacement":"Abc"},"string":"Str"}}}
268
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
269
-
270
- /**
271
- * @param {abc} foo
272
- */
273
- function qux(foo) {
274
- }
275
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"; prefer: \"Abc\".","replacement":"Abc"},"string":"Str"}}}
276
- // Message: Messed up JSDoc @param "foo" type "abc"; prefer: "Abc".
277
-
278
- /**
279
- * @param {abc} foo
280
- * @param {cde} bar
281
- * @param {object} baz
282
- */
283
- function qux(foo, bar, baz) {
284
- }
285
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"; prefer: \"Abc\".","replacement":"Abc"},"cde":{"message":"More messed up JSDoc @{{tagName}}{{tagValue}} type \"cde\"; prefer: \"Cde\".","replacement":"Cde"},"object":"Object"}}}
286
- // Message: Messed up JSDoc @param "foo" type "abc"; prefer: "Abc".
287
-
288
- /**
289
- * @param {abc} foo
290
- */
291
- function qux(foo) {
292
- }
293
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\".","replacement":false},"string":"Str"}}}
294
- // Message: Messed up JSDoc @param "foo" type "abc".
295
-
296
- /**
297
- * @param {abc} foo
298
- */
299
- function qux(foo) {
300
- }
301
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"."},"string":"Str"}}}
302
- // Message: Messed up JSDoc @param "foo" type "abc".
303
-
304
- /**
305
- * @param {abc} foo
306
- * @param {Number} bar
307
- */
308
- function qux(foo, bar) {
309
- }
310
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
311
- // "jsdoc/check-types": ["error"|"warn", {"noDefaults":true}]
312
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
313
-
314
- /**
315
- * @param {abc} foo
316
- * @param {Number} bar
317
- */
318
- function qux(foo, bar) {
319
- }
320
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
321
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
322
-
323
- /**
324
- * @param {abc} foo
325
- */
326
- function qux(foo) {
327
- }
328
- // Settings: {"jsdoc":{"preferredTypes":{"abc":false,"string":"Str"}}}
329
- // Message: Invalid JSDoc @param "foo" type "abc".
330
-
331
- /**
332
- * @param {abc} foo
333
- */
334
- function qux(foo) {
335
- }
336
- // Settings: {"jsdoc":{"preferredTypes":{"abc":false}}}
337
- // Message: Invalid JSDoc @param "foo" type "abc".
338
-
339
- /**
340
- * @param {*} baz
341
- */
342
- function qux(baz) {
343
- }
344
- // Settings: {"jsdoc":{"preferredTypes":{"*":false,"abc":"Abc","string":"Str"}}}
345
- // Message: Invalid JSDoc @param "baz" type "*".
346
-
347
- /**
348
- * @param {*} baz
349
- */
350
- function qux(baz) {
351
- }
352
- // Settings: {"jsdoc":{"preferredTypes":{"*":"aaa","abc":"Abc","string":"Str"}}}
353
- // Message: Invalid JSDoc @param "baz" type "*"; prefer: "aaa".
354
-
355
- /**
356
- * @param {abc} foo
357
- * @param {Number} bar
358
- */
359
- function qux(foo, bar) {
360
- }
361
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
362
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
363
-
364
- /**
365
- * @param {Array} foo
366
- */
367
- function quux (foo) {
368
-
369
- }
370
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
371
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
372
-
373
- /**
374
- * @param {Array} foo
375
- */
376
- function quux (foo) {
377
-
378
- }
379
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray","Array.<>":"GenericArray"}}}
380
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
381
-
382
- /**
383
- * @param {Array.<string>} foo
384
- */
385
- function quux (foo) {
386
-
387
- }
388
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"GenericArray"}}}
389
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
390
-
391
- /**
392
- * @param {Array<string>} foo
393
- */
394
- function quux (foo) {
395
-
396
- }
397
- // Settings: {"jsdoc":{"preferredTypes":{"Array<>":"GenericArray"}}}
398
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
399
-
400
- /**
401
- * @param {string[]} foo
402
- */
403
- function quux (foo) {
404
-
405
- }
406
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
407
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "SpecialTypeArray".
408
-
409
- /**
410
- * @param {string[]} foo
411
- */
412
- function quux (foo) {
413
-
414
- }
415
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
416
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
417
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "SpecialTypeArray".
418
-
419
- /**
420
- * @param {string[]} foo
421
- */
422
- function quux (foo) {
423
-
424
- }
425
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"SpecialTypeArray"}}}
426
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
427
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "SpecialTypeArray".
428
-
429
- /**
430
- * @param {object} foo
431
- */
432
- function quux (foo) {
433
-
434
- }
435
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
436
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
437
-
438
- /**
439
- * @param {object} foo
440
- */
441
- function quux (foo) {
442
-
443
- }
444
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject","object.<>":"GenericObject"}}}
445
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
446
-
447
- /**
448
- * @param {object} foo
449
- */
450
- function quux (foo) {
451
-
452
- }
453
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject","object<>":"GenericObject"}}}
454
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
455
-
456
- /**
457
- * @param {object.<string>} foo
458
- */
459
- function quux (foo) {
460
-
461
- }
462
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
463
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
464
-
465
- /**
466
- * @param {object<string>} foo
467
- */
468
- function quux (foo) {
469
-
470
- }
471
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
472
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
473
-
474
- /**
475
- * @param {object.<string, number>} foo
476
- */
477
- function quux (foo) {
478
-
479
- }
480
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
481
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
482
-
483
- /**
484
- * @param {object<string, number>} foo
485
- */
486
- function quux (foo) {
487
-
488
- }
489
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
490
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
491
-
492
- /**
493
- * @param {object.<string>} foo
494
- */
495
- function quux (foo) {
496
-
497
- }
498
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
499
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
500
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
501
-
502
- /**
503
- * @param {object<string>} foo
504
- */
505
- function quux (foo) {
506
-
507
- }
508
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
509
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
510
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
511
-
512
- /**
513
- * @param {object} foo
514
- */
515
- function quux (foo) {
516
-
517
- }
518
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
519
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
520
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
521
-
522
- /**
523
- * @param {object} foo
524
- */
525
- function quux (foo) {
526
-
527
- }
528
- // Settings: {"jsdoc":{"preferredTypes":{"object":false}}}
529
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
530
- // Message: Invalid JSDoc @param "foo" type "object".
531
-
532
- /**
533
- * @param {object} foo
534
- */
535
- function quux (foo) {
536
-
537
- }
538
- // Settings: {"jsdoc":{"preferredTypes":{"object":false}}}
539
- // Message: Invalid JSDoc @param "foo" type "object".
540
-
541
- /**
542
- * @param {object.<string, number>} foo
543
- */
544
- function quux (foo) {
545
-
546
- }
547
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
548
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
549
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
550
-
551
- /**
552
- * @param {object<string, number>} foo
553
- */
554
- function quux (foo) {
555
-
556
- }
557
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
558
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
559
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
560
-
561
- /**
562
- *
563
- * @param {string[][]} foo
564
- */
565
- function quux (foo) {
566
-
567
- }
568
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array."}}}
569
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array.".
570
-
571
- /**
572
- *
573
- * @param {string[][]} foo
574
- */
575
- function quux (foo) {
576
-
577
- }
578
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array.<>"}}}
579
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array.<>".
580
-
581
- /**
582
- *
583
- * @param {string[][]} foo
584
- */
585
- function quux (foo) {
586
-
587
- }
588
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array<>"}}}
589
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array<>".
590
-
591
- /**
592
- *
593
- * @param {object.<string, object.<string, string>>} foo
594
- */
595
- function quux (foo) {
596
-
597
- }
598
- // Settings: {"jsdoc":{"preferredTypes":{"object.":"Object"}}}
599
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
600
-
601
- /**
602
- *
603
- * @param {object.<string, object.<string, string>>} foo
604
- */
605
- function quux (foo) {
606
-
607
- }
608
- // Settings: {"jsdoc":{"preferredTypes":{"object.":"Object<>"}}}
609
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
610
-
611
- /**
612
- *
613
- * @param {object<string, object<string, string>>} foo
614
- */
615
- function quux (foo) {
616
-
617
- }
618
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object."}}}
619
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object.".
620
-
621
- /**
622
- *
623
- * @param {Array.<Array.<string>>} foo
624
- */
625
- function quux (foo) {
626
-
627
- }
628
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"[]"}}}
629
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
630
-
631
- /**
632
- *
633
- * @param {Array.<Array.<string>>} foo
634
- */
635
- function quux (foo) {
636
-
637
- }
638
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"Array<>"}}}
639
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array<>".
640
-
641
- /**
642
- *
643
- * @param {Array.<Array.<string>>} foo
644
- */
645
- function quux (foo) {
646
-
647
- }
648
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"<>"}}}
649
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "<>".
650
-
651
- /**
652
- *
653
- * @param {Array.<MyArray.<string>>} foo
654
- */
655
- function quux (foo) {
656
-
657
- }
658
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"<>"}}}
659
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "<>".
660
-
661
- /**
662
- *
663
- * @param {Array.<MyArray.<string>>} foo
664
- */
665
- function quux (foo) {
666
-
667
- }
668
- // Settings: {"jsdoc":{"preferredTypes":{"MyArray.":"<>"}}}
669
- // Message: Invalid JSDoc @param "foo" type "MyArray"; prefer: "<>".
670
-
671
- /**
672
- *
673
- * @param {Array<Array<string>>} foo
674
- */
675
- function quux (foo) {
676
-
677
- }
678
- // Settings: {"jsdoc":{"preferredTypes":{"<>":"Array."}}}
679
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array.".
680
-
681
- /**
682
- *
683
- * @param {Array<Array<string>>} foo
684
- */
685
- function quux (foo) {
686
-
687
- }
688
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"Array."}}}
689
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
690
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array.".
691
-
692
- /**
693
- *
694
- * @param {Array<Array<string>>} foo
695
- */
696
- function quux (foo) {
697
-
698
- }
699
- // Settings: {"jsdoc":{"preferredTypes":{"<>":"[]"}}}
700
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
701
-
702
- /** @typedef {String} foo */
703
- // Message: Invalid JSDoc @typedef "foo" type "String"; prefer: "string".
704
-
705
- /**
706
- * @this {array}
707
- */
708
- function quux () {}
709
- // Settings: {"jsdoc":{"mode":"closure"}}
710
- // Message: Invalid JSDoc @this type "array"; prefer: "Array".
711
-
712
- /**
713
- * @export {array}
714
- */
715
- function quux () {}
716
- // Settings: {"jsdoc":{"mode":"closure"}}
717
- // Message: Invalid JSDoc @export type "array"; prefer: "Array".
718
-
719
- /**
720
- * @typedef {object} foo
721
- * @property {object} bar
722
- */
723
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
724
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":true}]}]
725
- // Message: Invalid JSDoc @property "bar" type "object"; prefer: "Object".
726
-
727
- /** @typedef {object} foo */
728
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
729
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["array"]}]}]
730
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object".
731
-
732
- /**
733
- * @typedef {object} foo
734
- * @property {object} bar
735
- */
736
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
737
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object"]}]}]
738
- // Message: Invalid JSDoc @property "bar" type "object"; prefer: "Object".
739
-
740
- /** @typedef {object<string, string>} foo */
741
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object<>"}}}
742
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object"]}]}]
743
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object<>".
744
-
745
- /**
746
- * @param {Array<number | undefined>} foo
747
- */
748
- function quux (foo) {
749
-
750
- }
751
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"[]","Array<>":"[]"}}}
752
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
753
-
754
- /**
755
- * @typedef {object} foo
756
- */
757
- function a () {}
758
-
759
- /**
760
- * @typedef {Object<string>} foo
761
- */
762
- function b () {}
763
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object":"Object"}}}
764
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object".
765
-
766
- /**
767
- * @aCustomTag {Number} foo
768
- */
769
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":true}}}}
770
- // Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: "number".
771
-
772
- /**
773
- * @aCustomTag {Number} foo
774
- */
775
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
776
- // Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: ["otherType","anotherType"].
777
-
778
- /**
779
- * @param {Object[]} foo
780
- */
781
- function quux (foo) {
782
-
783
- }
784
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object"}}}
785
- // Message: Invalid JSDoc @param "foo" type "Object"; prefer: "object".
786
-
787
- /**
788
- * @param {object.<string>} foo
789
- */
790
- function quux (foo) {
791
-
792
- }
793
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object.<>":"Object"}}}
794
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
795
-
796
- /**
797
- * @param {object.<string, number>} foo
798
- */
799
- function quux (foo) {
800
- }
801
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
802
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
803
-
804
- /**
805
- * @param {Object.<string, number>} foo
806
- */
807
- function quux (foo) {
808
- }
809
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
810
- // Message: Invalid JSDoc @param "foo" type "Object"; prefer: "Object<>".
811
-
812
- /**
813
- * @param {object<string, number>} foo
814
- */
815
- function quux (foo) {
816
- }
817
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
818
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
819
-
820
- /**
821
- * @param {object.<string>} foo
822
- */
823
- function quux (foo) {
824
-
825
- }
826
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","Object.<>":"Object<>","object<>":"Object<>"}}}
827
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
828
-
829
- /**
830
- * @param {object.<string>} foo
831
- */
832
- function quux (foo) {
833
-
834
- }
835
- // Settings: {"jsdoc":{"mode":"typescript"}}
836
- // Message: Use object shorthand or index signatures instead of `object`, e.g., `{[key: string]: string}`
837
-
838
- /**
839
- *
840
- * @param {Object} param
841
- * @return {Object | String}
842
- */
843
- function abc(param) {
844
- if (param.a)
845
- return {};
846
- return 'abc';
847
- }
848
- // Message: Invalid JSDoc @param "param" type "Object"; prefer: "object".
849
-
850
- /**
851
- * @param {object} root
852
- * @param {number} root.a
853
- * @param {object} b
854
- */
855
- function a () {}
856
- // Settings: {"jsdoc":{"preferredTypes":{"object":{"skipRootChecking":true}}}}
857
- // Message: Invalid JSDoc @param "b" type "object".
858
- ````
859
-
860
-
861
-
862
- <a name="user-content-check-types-passing-examples"></a>
863
- <a name="check-types-passing-examples"></a>
864
- ## Passing examples
865
-
866
- The following patterns are not considered problems:
867
-
868
- ````js
869
- /**
870
- * @param {number} foo
871
- * @param {Bar} bar
872
- * @param {*} baz
873
- */
874
- function quux (foo, bar, baz) {
875
-
876
- }
877
-
878
- /**
879
- * @arg {number} foo
880
- * @arg {Bar} bar
881
- * @arg {*} baz
882
- */
883
- function quux (foo, bar, baz) {
884
-
885
- }
886
-
887
- /**
888
- * @param {(number | string | boolean)=} foo
889
- */
890
- function quux (foo, bar, baz) {
891
-
892
- }
893
-
894
- /**
895
- * @param {typeof bar} foo
896
- */
897
- function qux(foo) {
898
- }
899
-
900
- /**
901
- * @param {import('./foo').bar.baz} foo
902
- */
903
- function qux(foo) {
904
- }
905
-
906
- /**
907
- * @param {(x: number, y: string) => string} foo
908
- */
909
- function qux(foo) {
910
- }
911
-
912
- /**
913
- * @param {() => string} foo
914
- */
915
- function qux(foo) {
916
- }
917
-
918
- /**
919
- * @returns {Number} foo
920
- * @throws {Number} foo
921
- */
922
- function quux () {
923
-
924
- }
925
- // "jsdoc/check-types": ["error"|"warn", {"noDefaults":true}]
926
-
927
- /**
928
- * @param {Object} foo
929
- */
930
- function quux (foo) {
931
-
932
- }
933
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
934
-
935
- /**
936
- * @param {Array} foo
937
- */
938
- function quux (foo) {
939
-
940
- }
941
-
942
- /**
943
- * @param {Array.<string>} foo
944
- */
945
- function quux (foo) {
946
-
947
- }
948
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
949
-
950
- /**
951
- * @param {Array<string>} foo
952
- */
953
- function quux (foo) {
954
-
955
- }
956
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
957
-
958
- /**
959
- * @param {string[]} foo
960
- */
961
- function quux (foo) {
962
-
963
- }
964
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"SpecialTypeArray","Array.<>":"SpecialTypeArray","Array<>":"SpecialTypeArray"}}}
965
-
966
- /**
967
- * @param {string[]} foo
968
- */
969
- function quux (foo) {
970
-
971
- }
972
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"SpecialTypeArray","Array<>":"SpecialTypeArray"}}}
973
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
974
-
975
- /**
976
- * @param {Array} foo
977
- */
978
- function quux (foo) {
979
-
980
- }
981
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
982
-
983
- /**
984
- * @param {Array} foo
985
- */
986
- function quux (foo) {
987
-
988
- }
989
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
990
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
991
-
992
- /**
993
- * @param {Array} foo
994
- */
995
- function quux (foo) {
996
-
997
- }
998
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"GenericArray"}}}
999
-
1000
- /**
1001
- * @param {Array} foo
1002
- */
1003
- function quux (foo) {
1004
-
1005
- }
1006
- // Settings: {"jsdoc":{"preferredTypes":{"Array<>":"GenericArray"}}}
1007
-
1008
- /**
1009
- * @param {object} foo
1010
- */
1011
- function quux (foo) {
1012
-
1013
- }
1014
-
1015
- /**
1016
- * @param {object.<string>} foo
1017
- */
1018
- function quux (foo) {
1019
-
1020
- }
1021
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
1022
-
1023
- /**
1024
- * @param {object<string>} foo
1025
- */
1026
- function quux (foo) {
1027
-
1028
- }
1029
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
1030
-
1031
- /**
1032
- * @param {object.<string, number>} foo
1033
- */
1034
- function quux (foo) {
1035
-
1036
- }
1037
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
1038
-
1039
- /**
1040
- * @param {object<string, number>} foo
1041
- */
1042
- function quux (foo) {
1043
-
1044
- }
1045
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
1046
-
1047
- /**
1048
- * @param {object} foo
1049
- */
1050
- function quux (foo) {
1051
-
1052
- }
1053
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
1054
-
1055
- /**
1056
- * @param {object} foo
1057
- */
1058
- function quux (foo) {
1059
-
1060
- }
1061
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
1062
-
1063
- /**
1064
- * @param {Number<} Ignore the error as not a validating rule
1065
- */
1066
- function quux (foo) {
1067
-
1068
- }
1069
-
1070
- /** @param {function(...)} callback The function to invoke. */
1071
- var subscribe = function(callback) {};
1072
-
1073
- /**
1074
- * @this {Array}
1075
- */
1076
- function quux () {}
1077
- // Settings: {"jsdoc":{"mode":"closure"}}
1078
-
1079
- /**
1080
- * @export {Array}
1081
- */
1082
- function quux () {}
1083
- // Settings: {"jsdoc":{"mode":"closure"}}
1084
-
1085
- /** @type {new() => EntityBase} */
1086
-
1087
- /** @typedef {object} foo */
1088
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
1089
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":true}]}]
1090
-
1091
- /** @typedef {object<string, string>} foo */
1092
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
1093
-
1094
- /** @typedef {object<string, string>} foo */
1095
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object<>"}}}
1096
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object<string, string>"]}]}]
1097
-
1098
- /**
1099
- * @typedef {object} foo
1100
- */
1101
-
1102
- /**
1103
- * @typedef {Object} foo
1104
- */
1105
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object","Object":"object"}}}
1106
-
1107
- /**
1108
- * @typedef {object} foo
1109
- */
1110
- function a () {}
1111
-
1112
- /**
1113
- * @typedef {Object} foo
1114
- */
1115
- function b () {}
1116
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object","Object":"object"}}}
1117
-
1118
- /**
1119
- * @typedef {object} foo
1120
- */
1121
- function a () {}
1122
-
1123
- /**
1124
- * @typedef {{[key: string]: number}} foo
1125
- */
1126
- function b () {}
1127
- // Settings: {"jsdoc":{"mode":"typescript"}}
1128
-
1129
- /**
1130
- * @aCustomTag {Number} foo
1131
- */
1132
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
1133
-
1134
- /**
1135
- * @aCustomTag {otherType} foo
1136
- */
1137
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
1138
-
1139
- /**
1140
- * @aCustomTag {anotherType|otherType} foo
1141
- */
1142
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
1143
-
1144
- /**
1145
- * Bad types handled by `valid-types` instead.
1146
- * @param {str(} foo
1147
- */
1148
- function quux (foo) {
1149
-
1150
- }
1151
-
1152
- /**
1153
- * @param {{[key: string]: number}} foo
1154
- */
1155
- function quux (foo) {
1156
-
1157
- }
1158
- // Settings: {"jsdoc":{"mode":"typescript"}}
1159
-
1160
- /**
1161
- * @typedef {object} foo
1162
- */
1163
- function a () {}
1164
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","object<>":"Object<>"}}}
1165
-
1166
- /**
1167
- * @typedef {Object<string, number>} foo
1168
- */
1169
- function a () {}
1170
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"Object":"object","object.<>":"Object<>","object<>":"Object<>"}}}
1171
-
1172
- /**
1173
- * Does something.
1174
- *
1175
- * @param {Object<string,string>} spec - Foo.
1176
- */
1177
- function foo(spec) {
1178
- return spec;
1179
- }
1180
-
1181
- foo()
1182
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
1183
-
1184
- /**
1185
- * @param {object} root
1186
- * @param {number} root.a
1187
- */
1188
- function a () {}
1189
- // Settings: {"jsdoc":{"preferredTypes":{"object":{"message":"Won't see this message","skipRootChecking":true}}}}
1190
-
1191
- /**
1192
- * @returns {string | undefined} a string or undefined
1193
- */
1194
- function quux () {}
1195
- // Settings: {"jsdoc":{"preferredTypes":{"[]":{"message":"Do not use *[], use Array<*> instead","replacement":"Array"}}}}
1196
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
1197
- ````
1198
-