eslint-plugin-jsdoc 43.1.1 → 44.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +58 -24393
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js.map +1 -1
  4. package/dist/bin/generateRule.js.map +1 -1
  5. package/dist/exportParser.js.map +1 -1
  6. package/dist/generateRule.js.map +1 -1
  7. package/dist/iterateJsdoc.js +2 -2
  8. package/dist/iterateJsdoc.js.map +1 -1
  9. package/dist/jsdocUtils.js.map +1 -1
  10. package/dist/rules/checkAccess.js.map +1 -1
  11. package/dist/rules/checkExamples.js.map +1 -1
  12. package/dist/rules/checkLineAlignment.js.map +1 -1
  13. package/dist/rules/checkParamNames.js.map +1 -1
  14. package/dist/rules/checkPropertyNames.js.map +1 -1
  15. package/dist/rules/checkTagNames.js.map +1 -1
  16. package/dist/rules/checkTypes.js.map +1 -1
  17. package/dist/rules/checkValues.js.map +1 -1
  18. package/dist/rules/emptyTags.js.map +1 -1
  19. package/dist/rules/implementsOnClasses.js.map +1 -1
  20. package/dist/rules/informativeDocs.js.map +1 -1
  21. package/dist/rules/matchDescription.js.map +1 -1
  22. package/dist/rules/matchName.js.map +1 -1
  23. package/dist/rules/multilineBlocks.js.map +1 -1
  24. package/dist/rules/noBadBlocks.js.map +1 -1
  25. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  26. package/dist/rules/noBlankBlocks.js.map +1 -1
  27. package/dist/rules/noDefaults.js.map +1 -1
  28. package/dist/rules/noMultiAsterisks.js.map +1 -1
  29. package/dist/rules/noTypes.js.map +1 -1
  30. package/dist/rules/noUndefinedTypes.js.map +1 -1
  31. package/dist/rules/requireDescription.js.map +1 -1
  32. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  33. package/dist/rules/requireExample.js.map +1 -1
  34. package/dist/rules/requireFileOverview.js.map +1 -1
  35. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  36. package/dist/rules/requireJsdoc.js.map +1 -1
  37. package/dist/rules/requireParam.js.map +1 -1
  38. package/dist/rules/requireParamDescription.js.map +1 -1
  39. package/dist/rules/requireParamName.js.map +1 -1
  40. package/dist/rules/requireParamType.js.map +1 -1
  41. package/dist/rules/requirePropertyDescription.js.map +1 -1
  42. package/dist/rules/requirePropertyName.js.map +1 -1
  43. package/dist/rules/requirePropertyType.js.map +1 -1
  44. package/dist/rules/requireReturns.js.map +1 -1
  45. package/dist/rules/requireReturnsCheck.js.map +1 -1
  46. package/dist/rules/requireReturnsDescription.js.map +1 -1
  47. package/dist/rules/requireThrows.js.map +1 -1
  48. package/dist/rules/requireYields.js.map +1 -1
  49. package/dist/rules/requireYieldsCheck.js.map +1 -1
  50. package/dist/rules/sortTags.js.map +1 -1
  51. package/dist/rules/tagLines.js.map +1 -1
  52. package/dist/rules/textEscaping.js.map +1 -1
  53. package/dist/rules/validTypes.js.map +1 -1
  54. package/dist/utils/hasReturnValue.js.map +1 -1
  55. package/docs/advanced.md +102 -0
  56. package/docs/rules/check-access.md +193 -0
  57. package/docs/rules/check-alignment.md +169 -0
  58. package/docs/rules/check-examples.md +784 -0
  59. package/docs/rules/check-indentation.md +296 -0
  60. package/docs/rules/check-line-alignment.md +995 -0
  61. package/docs/rules/check-param-names.md +1035 -0
  62. package/docs/rules/check-property-names.md +244 -0
  63. package/docs/rules/check-syntax.md +80 -0
  64. package/docs/rules/check-tag-names.md +1117 -0
  65. package/docs/rules/check-types.md +1198 -0
  66. package/docs/rules/check-values.md +409 -0
  67. package/docs/rules/empty-tags.md +220 -0
  68. package/docs/rules/implements-on-classes.md +219 -0
  69. package/docs/rules/informative-docs.md +400 -0
  70. package/docs/rules/match-description.md +979 -0
  71. package/docs/rules/match-name.md +243 -0
  72. package/docs/rules/multiline-blocks.md +398 -0
  73. package/docs/rules/no-bad-blocks.md +174 -0
  74. package/docs/rules/no-blank-block-descriptions.md +91 -0
  75. package/docs/rules/no-blank-blocks.md +98 -0
  76. package/docs/rules/no-defaults.md +207 -0
  77. package/docs/rules/no-missing-syntax.md +269 -0
  78. package/docs/rules/no-multi-asterisks.md +278 -0
  79. package/docs/rules/no-restricted-syntax.md +377 -0
  80. package/docs/rules/no-types.md +168 -0
  81. package/docs/rules/no-undefined-types.md +731 -0
  82. package/docs/rules/require-asterisk-prefix.md +297 -0
  83. package/docs/rules/require-description-complete-sentence.md +584 -0
  84. package/docs/rules/require-description.md +820 -0
  85. package/docs/rules/require-example.md +390 -0
  86. package/docs/rules/require-file-overview.md +317 -0
  87. package/docs/rules/require-hyphen-before-param-description.md +258 -0
  88. package/docs/rules/require-jsdoc.md +1837 -0
  89. package/docs/rules/require-param-description.md +1816 -0
  90. package/docs/rules/require-param-name.md +238 -0
  91. package/docs/rules/require-param-type.md +163 -0
  92. package/docs/rules/require-param.md +227 -0
  93. package/docs/rules/require-property-description.md +128 -0
  94. package/docs/rules/require-property-name.md +88 -0
  95. package/docs/rules/require-property-type.md +79 -0
  96. package/docs/rules/require-property.md +79 -0
  97. package/docs/rules/require-returns-check.md +1164 -0
  98. package/docs/rules/require-returns-description.md +1053 -0
  99. package/docs/rules/require-returns-type.md +181 -0
  100. package/docs/rules/require-returns.md +144 -0
  101. package/docs/rules/require-throws.md +326 -0
  102. package/docs/rules/require-yields-check.md +823 -0
  103. package/docs/rules/require-yields.md +544 -0
  104. package/docs/rules/sort-tags.md +635 -0
  105. package/docs/rules/tag-lines.md +551 -0
  106. package/docs/rules/text-escaping.md +177 -0
  107. package/docs/rules/valid-types.md +834 -0
  108. package/docs/settings.md +355 -0
  109. package/package.json +15 -15
@@ -0,0 +1,979 @@
1
+ <a name="user-content-match-description"></a>
2
+ <a name="match-description"></a>
3
+ # <code>match-description</code>
4
+
5
+ * [Options](#user-content-match-description-options)
6
+ * [`matchDescription`](#user-content-match-description-options-matchdescription)
7
+ * [`message`](#user-content-match-description-options-message)
8
+ * [`tags`](#user-content-match-description-options-tags)
9
+ * [`mainDescription`](#user-content-match-description-options-maindescription)
10
+ * [`contexts`](#user-content-match-description-options-contexts)
11
+ * [Context and settings](#user-content-match-description-context-and-settings)
12
+ * [Failing examples](#user-content-match-description-failing-examples)
13
+ * [Passing examples](#user-content-match-description-passing-examples)
14
+
15
+
16
+ Enforces a regular expression pattern on descriptions.
17
+
18
+ The default is this basic expression to match English sentences (Support
19
+ for Unicode upper case may be added in a future version when it can be handled
20
+ by our supported Node versions):
21
+
22
+ ``^\n?([A-Z`\\d_][\\s\\S]*[.?!`]\\s*)?$``
23
+
24
+ Applies to the jsdoc block description and `@description` (or `@desc`)
25
+ by default but the `tags` option (see below) may be used to match other tags.
26
+
27
+ The default (and all regex options) defaults to using (only) the `u` flag, so
28
+ to add your own flags, encapsulate your expression as a string, but like a
29
+ literal, e.g., `/[A-Z].*\\./ui`.
30
+
31
+ Note that `/` delimiters are optional, but necessary to add flags (besides
32
+ `u`).
33
+
34
+ Also note that the default or optional regular expressions is *not*
35
+ case-insensitive unless one opts in to add the `i` flag.
36
+
37
+ You can add the `s` flag if you want `.` to match newlines. Note, however,
38
+ that the trailing newlines of a description will not be matched.
39
+
40
+ <a name="user-content-match-description-options"></a>
41
+ <a name="match-description-options"></a>
42
+ ## Options
43
+
44
+ <a name="user-content-match-description-options-matchdescription"></a>
45
+ <a name="match-description-options-matchdescription"></a>
46
+ ### <code>matchDescription</code>
47
+
48
+ You can supply your own expression to override the default, passing a
49
+ `matchDescription` string on the options object.
50
+
51
+ ```js
52
+ {
53
+ 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\.'}]
54
+ }
55
+ ```
56
+
57
+ <a name="user-content-match-description-options-message"></a>
58
+ <a name="match-description-options-message"></a>
59
+ ### <code>message</code>
60
+
61
+ You may provide a custom default message by using the following format:
62
+
63
+ ```js
64
+ {
65
+ 'jsdoc/match-description': ['error', {
66
+ message: 'The default description should begin with a capital letter.'
67
+ }]
68
+ }
69
+ ```
70
+
71
+ This can be overridden per tag or for the main block description by setting
72
+ `message` within `tags` or `mainDescription`, respectively.
73
+
74
+ <a name="user-content-match-description-options-tags"></a>
75
+ <a name="match-description-options-tags"></a>
76
+ ### <code>tags</code>
77
+
78
+ If you want different regular expressions to apply to tags, you may use
79
+ the `tags` option object:
80
+
81
+ ```js
82
+ {
83
+ 'jsdoc/match-description': ['error', {tags: {
84
+ param: '\\- [A-Z].*\\.',
85
+ returns: '[A-Z].*\\.'
86
+ }}]
87
+ }
88
+ ```
89
+
90
+ In place of a string, you can also add `true` to indicate that a particular
91
+ tag should be linted with the `matchDescription` value (or the default).
92
+
93
+ ```js
94
+ {
95
+ 'jsdoc/match-description': ['error', {tags: {
96
+ param: true,
97
+ returns: true
98
+ }}]
99
+ }
100
+ ```
101
+
102
+ Alternatively, you may supply an object with a `message` property to indicate
103
+ the error message for that tag.
104
+
105
+ ```js
106
+ {
107
+ 'jsdoc/match-description': ['error', {tags: {
108
+ param: {message: 'Begin with a hyphen', match: '\\- [A-Z].*\\.'},
109
+ returns: {message: 'Capitalize for returns (the default)', match: true}
110
+ }}]
111
+ }
112
+ ```
113
+
114
+ The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
115
+ parsed to ensure that the matched "description" text includes only the text
116
+ after the name.
117
+
118
+ All other tags will treat the text following the tag name, a space, and
119
+ an optional curly-bracketed type expression (and another space) as part of
120
+ its "description" (e.g., for `@returns {someType} some description`, the
121
+ description is `some description` while for `@some-tag xyz`, the description
122
+ is `xyz`).
123
+
124
+ <a name="user-content-match-description-options-maindescription"></a>
125
+ <a name="match-description-options-maindescription"></a>
126
+ ### <code>mainDescription</code>
127
+
128
+ If you wish to override the main block description without changing the
129
+ default `match-description` (which can cascade to the `tags` with `true`),
130
+ you may use `mainDescription`:
131
+
132
+ ```js
133
+ {
134
+ 'jsdoc/match-description': ['error', {
135
+ mainDescription: '[A-Z].*\\.',
136
+ tags: {
137
+ param: true,
138
+ returns: true
139
+ }
140
+ }]
141
+ }
142
+ ```
143
+
144
+ There is no need to add `mainDescription: true`, as by default, the main
145
+ block description (and only the main block description) is linted, though you
146
+ may disable checking it by setting it to `false`.
147
+
148
+ You may also provide an object with `message`:
149
+
150
+ ```js
151
+ {
152
+ 'jsdoc/match-description': ['error', {
153
+ mainDescription: {
154
+ message: 'Capitalize first word of JSDoc block descriptions',
155
+ match: '[A-Z].*\\.'
156
+ },
157
+ tags: {
158
+ param: true,
159
+ returns: true
160
+ }
161
+ }]
162
+ }
163
+ ```
164
+
165
+ <a name="user-content-match-description-options-contexts"></a>
166
+ <a name="match-description-options-contexts"></a>
167
+ ### <code>contexts</code>
168
+
169
+ Set this to an array of strings representing the AST context (or an object with
170
+ `context` and `comment` properties) where you wish the rule to be applied.
171
+ (e.g., `ClassDeclaration` for ES6
172
+ classes). Overrides the default contexts (see below). Set to `"any"` if you
173
+ want the rule to apply to any jsdoc block throughout your files.
174
+
175
+ See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
176
+ section of our README for more on the expected format.
177
+
178
+ <a name="user-content-match-description-context-and-settings"></a>
179
+ <a name="match-description-context-and-settings"></a>
180
+ ## Context and settings
181
+
182
+ |||
183
+ |---|---|
184
+ |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
185
+ |Tags|docblock and `@description` by default but more with `tags`|
186
+ |Aliases|`@desc`|
187
+ |Recommended|false|
188
+ |Settings||
189
+ |Options|`contexts`, `tags` (accepts tags with names and optional type such as 'param', 'arg', 'argument', 'property', and 'prop', and accepts arbitrary list of other tags with an optional type (but without names), e.g., 'returns', 'return'), `mainDescription`, `matchDescription`|
190
+
191
+ <a name="user-content-match-description-failing-examples"></a>
192
+ <a name="match-description-failing-examples"></a>
193
+ ## Failing examples
194
+
195
+ The following patterns are considered problems:
196
+
197
+ ````js
198
+ /**
199
+ * foo.
200
+ */
201
+ const q = class {
202
+
203
+ }
204
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassExpression"]}]
205
+ // Message: JSDoc description does not satisfy the regex pattern.
206
+
207
+ /**
208
+ * foo.
209
+ */
210
+ const q = class {
211
+
212
+ }
213
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassExpression"],"message":"Needs to begin with a capital letter and end with an end mark."}]
214
+ // Message: Needs to begin with a capital letter and end with an end mark.
215
+
216
+ /**
217
+ * foo.
218
+ */
219
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"]}]
220
+ // Message: JSDoc description does not satisfy the regex pattern.
221
+
222
+ /**
223
+ * foo.
224
+ */
225
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"]}]
226
+ // Message: JSDoc description does not satisfy the regex pattern.
227
+
228
+ /**
229
+ * foo.
230
+ */
231
+ const q = {
232
+
233
+ };
234
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["ObjectExpression"]}]
235
+ // Message: JSDoc description does not satisfy the regex pattern.
236
+
237
+ /**
238
+ * foo.
239
+ */
240
+ function quux () {
241
+
242
+ }
243
+ // Message: JSDoc description does not satisfy the regex pattern.
244
+
245
+ /**
246
+ * Foo)
247
+ */
248
+ function quux () {
249
+
250
+ }
251
+ // Message: JSDoc description does not satisfy the regex pattern.
252
+
253
+ /**
254
+ * тест.
255
+ */
256
+ function quux () {
257
+
258
+ }
259
+ // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\."}]
260
+ // Message: JSDoc description does not satisfy the regex pattern.
261
+
262
+ /**
263
+ * тест.
264
+ */
265
+ function quux () {
266
+
267
+ }
268
+ // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\.","message":"Needs to begin with a capital letter and end with an end mark."}]
269
+ // Message: Needs to begin with a capital letter and end with an end mark.
270
+
271
+ /**
272
+ * Abc.
273
+ */
274
+ function quux () {
275
+
276
+ }
277
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":"[А-Я][А-я]+\\.","tags":{"param":true}}]
278
+ // Message: JSDoc description does not satisfy the regex pattern.
279
+
280
+ /**
281
+ * Abc.
282
+ */
283
+ function quux () {
284
+
285
+ }
286
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"[А-Я][А-я]+\\.","message":"Needs to begin with a Cyrillic capital letter and end with a period."},"tags":{"param":true}}]
287
+ // Message: Needs to begin with a Cyrillic capital letter and end with a period.
288
+
289
+ /**
290
+ * Foo
291
+ */
292
+ function quux () {
293
+
294
+ }
295
+ // Message: JSDoc description does not satisfy the regex pattern.
296
+
297
+ /**
298
+ * Foo.
299
+ *
300
+ * @param foo foo.
301
+ */
302
+ function quux (foo) {
303
+
304
+ }
305
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
306
+ // Message: JSDoc description does not satisfy the regex pattern.
307
+
308
+ /**
309
+ * Foo.
310
+ *
311
+ * @template Abc, Def foo.
312
+ */
313
+ function quux (foo) {
314
+
315
+ }
316
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"template":true}}]
317
+ // Message: JSDoc description does not satisfy the regex pattern.
318
+
319
+ /**
320
+ * Foo.
321
+ *
322
+ * @prop foo foo.
323
+ */
324
+ function quux (foo) {
325
+
326
+ }
327
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"prop":true}}]
328
+ // Message: JSDoc description does not satisfy the regex pattern.
329
+
330
+ /**
331
+ * Foo.
332
+ *
333
+ * @summary foo.
334
+ */
335
+ function quux () {
336
+
337
+ }
338
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"summary":true}}]
339
+ // Message: JSDoc description does not satisfy the regex pattern.
340
+
341
+ /**
342
+ * Foo.
343
+ *
344
+ * @author
345
+ */
346
+ function quux () {
347
+
348
+ }
349
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"author":".+"}}]
350
+ // Message: JSDoc description does not satisfy the regex pattern.
351
+
352
+ /**
353
+ * Foo.
354
+ *
355
+ * @x-tag
356
+ */
357
+ function quux () {
358
+
359
+ }
360
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"x-tag":".+"}}]
361
+ // Message: JSDoc description does not satisfy the regex pattern.
362
+
363
+ /**
364
+ * Foo.
365
+ *
366
+ * @description foo foo.
367
+ */
368
+ function quux (foo) {
369
+
370
+ }
371
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
372
+ // Message: JSDoc description does not satisfy the regex pattern.
373
+
374
+ /**
375
+ * Foo
376
+ *
377
+ * @param foo foo.
378
+ */
379
+ function quux (foo) {
380
+
381
+ }
382
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":"^[a-zA-Z]*\\s*$","tags":{"param":true}}]
383
+ // Message: JSDoc description does not satisfy the regex pattern.
384
+
385
+ /**
386
+ * Foo
387
+ *
388
+ * @param foo foo.
389
+ */
390
+ function quux (foo) {
391
+
392
+ }
393
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"^[a-zA-Z]*\\s*$","message":"Letters only"},"tags":{"param":{"match":true,"message":"Needs to begin with a capital letter and end with a period."}}}]
394
+ // Message: Needs to begin with a capital letter and end with a period.
395
+
396
+ /**
397
+ * Foo
398
+ *
399
+ * @param foo foo.
400
+ */
401
+ function quux (foo) {
402
+
403
+ }
404
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":false,"tags":{"param":true}}]
405
+ // Message: JSDoc description does not satisfy the regex pattern.
406
+
407
+ /**
408
+ * Foo.
409
+ *
410
+ * @param foo bar
411
+ */
412
+ function quux (foo) {
413
+
414
+ }
415
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
416
+ // Message: JSDoc description does not satisfy the regex pattern.
417
+
418
+ /**
419
+ * {@see Foo.bar} buz
420
+ */
421
+ function quux (foo) {
422
+
423
+ }
424
+ // Message: JSDoc description does not satisfy the regex pattern.
425
+
426
+ /**
427
+ * Foo.
428
+ *
429
+ * @returns {number} foo
430
+ */
431
+ function quux (foo) {
432
+
433
+ }
434
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
435
+ // Message: JSDoc description does not satisfy the regex pattern.
436
+
437
+ /**
438
+ * Foo.
439
+ *
440
+ * @returns foo.
441
+ */
442
+ function quux (foo) {
443
+
444
+ }
445
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
446
+ // Message: JSDoc description does not satisfy the regex pattern.
447
+
448
+ /**
449
+ * lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque elit diam,
450
+ * iaculis eu dignissim sed, ultrices sed nisi. nulla at ligula auctor, consectetur neque sed,
451
+ * tincidunt nibh. vivamus sit amet vulputate ligula. vivamus interdum elementum nisl,
452
+ * vitae rutrum tortor semper ut. morbi porta ante vitae dictum fermentum.
453
+ * proin ut nulla at quam convallis gravida in id elit. sed dolor mauris, blandit quis ante at,
454
+ * consequat auctor magna. duis pharetra purus in porttitor mollis.
455
+ */
456
+ function longDescription (foo) {
457
+
458
+ }
459
+ // Message: JSDoc description does not satisfy the regex pattern.
460
+
461
+ /**
462
+ * @arg {number} foo - Foo
463
+ */
464
+ function quux (foo) {
465
+
466
+ }
467
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"arg":true}}]
468
+ // Message: JSDoc description does not satisfy the regex pattern.
469
+
470
+ /**
471
+ * @argument {number} foo - Foo
472
+ */
473
+ function quux (foo) {
474
+
475
+ }
476
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"argument":true}}]
477
+ // Message: JSDoc description does not satisfy the regex pattern.
478
+
479
+ /**
480
+ * @return {number} foo
481
+ */
482
+ function quux (foo) {
483
+
484
+ }
485
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"return":true}}]
486
+ // Message: JSDoc description does not satisfy the regex pattern.
487
+
488
+ /**
489
+ * Returns bar.
490
+ *
491
+ * @return {number} bar
492
+ */
493
+ function quux (foo) {
494
+
495
+ }
496
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"return":true}}]
497
+ // Message: JSDoc description does not satisfy the regex pattern.
498
+
499
+ /**
500
+ * @param notRet
501
+ * @returns Тест.
502
+ */
503
+ function quux () {
504
+
505
+ }
506
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":"[А-Я][А-я]+\\."}}]
507
+ // Message: JSDoc description does not satisfy the regex pattern.
508
+
509
+ /**
510
+ * @description notRet
511
+ * @returns Тест.
512
+ */
513
+ function quux () {
514
+
515
+ }
516
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":"[А-Я][А-я]+\\."}}]
517
+ // Message: JSDoc description does not satisfy the regex pattern.
518
+
519
+ /**
520
+ * foo.
521
+ */
522
+ class quux {
523
+
524
+ }
525
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
526
+ // Message: JSDoc description does not satisfy the regex pattern.
527
+
528
+ class MyClass {
529
+ /**
530
+ * Abc
531
+ */
532
+ myClassField = 1
533
+ }
534
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["PropertyDefinition"]}]
535
+ // Message: JSDoc description does not satisfy the regex pattern.
536
+
537
+ /**
538
+ * foo.
539
+ */
540
+ interface quux {
541
+
542
+ }
543
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
544
+ // Message: JSDoc description does not satisfy the regex pattern.
545
+
546
+ const myObject = {
547
+ /**
548
+ * Bad description
549
+ */
550
+ myProp: true
551
+ };
552
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["Property"]}]
553
+ // Message: JSDoc description does not satisfy the regex pattern.
554
+
555
+ /**
556
+ * @param foo Foo bar
557
+ */
558
+ function quux (foo) {
559
+
560
+ }
561
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
562
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
563
+ // Message: JSDoc description does not satisfy the regex pattern.
564
+
565
+ /**
566
+ * Foo bar
567
+ */
568
+ function quux (foo) {
569
+
570
+ }
571
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
572
+ // Message: JSDoc description does not satisfy the regex pattern.
573
+
574
+ /**
575
+ * Description with extra new line
576
+ *
577
+ */
578
+ function quux () {
579
+
580
+ }
581
+ // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[\\s\\S]*\\S$"}]
582
+ // Message: JSDoc description does not satisfy the regex pattern.
583
+
584
+ /**
585
+ *
586
+ * This function does lots of things.
587
+ */
588
+ function quux () {
589
+
590
+ }
591
+ // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"^\\S[\\s\\S]*\\S$"}]
592
+ // Message: JSDoc description does not satisfy the regex pattern.
593
+
594
+ /**
595
+ *
596
+ * @param
597
+ */
598
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"],"matchDescription":"^\\S[\\s\\S]*\\S$"}]
599
+ // Message: JSDoc description does not satisfy the regex pattern.
600
+
601
+ /** Does something very important. */
602
+ function foo(): string;
603
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[endLine=0]"}],"matchDescription":"^\\S[\\s\\S]*\\S$"}]
604
+ // Message: JSDoc description does not satisfy the regex pattern.
605
+ ````
606
+
607
+
608
+
609
+ <a name="user-content-match-description-passing-examples"></a>
610
+ <a name="match-description-passing-examples"></a>
611
+ ## Passing examples
612
+
613
+ The following patterns are not considered problems:
614
+
615
+ ````js
616
+ /**
617
+ *
618
+ */
619
+
620
+ /**
621
+ *
622
+ */
623
+ function quux () {
624
+
625
+ }
626
+
627
+ /**
628
+ * @param foo - Foo.
629
+ */
630
+ function quux () {
631
+
632
+ }
633
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
634
+
635
+ /**
636
+ * Foo.
637
+ */
638
+ function quux () {
639
+
640
+ }
641
+
642
+ /**
643
+ * Foo.
644
+ * Bar.
645
+ */
646
+ function quux () {
647
+
648
+ }
649
+
650
+ /**
651
+ * Foo.
652
+ *
653
+ * Bar.
654
+ */
655
+ function quux () {
656
+
657
+ }
658
+
659
+ /**
660
+ * Foo.
661
+ *
662
+ * Bar.
663
+ */
664
+ function quux () {
665
+
666
+ }
667
+ // "jsdoc/match-description": ["error"|"warn", {"message":"This won't be shown"}]
668
+
669
+ /**
670
+ * Тест.
671
+ */
672
+ function quux () {
673
+
674
+ }
675
+ // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\."}]
676
+
677
+ /**
678
+ * @param notRet
679
+ * @returns Тест.
680
+ */
681
+ function quux () {
682
+
683
+ }
684
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":"[А-Я][А-я]+\\."}}]
685
+
686
+ /**
687
+ * @param notRet
688
+ * @description Тест.
689
+ */
690
+ function quux () {
691
+
692
+ }
693
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":"[А-Я][А-я]+\\."}}]
694
+
695
+ /**
696
+ * Foo
697
+ * bar.
698
+ */
699
+ function quux () {
700
+
701
+ }
702
+
703
+ /**
704
+ * @returns Foo bar.
705
+ */
706
+ function quux () {
707
+
708
+ }
709
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
710
+
711
+ /**
712
+ * @returns {type1} Foo bar.
713
+ */
714
+ function quux () {
715
+
716
+ }
717
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
718
+
719
+ /**
720
+ * @description Foo bar.
721
+ */
722
+ function quux () {
723
+
724
+ }
725
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
726
+
727
+ /**
728
+ * @description Foo
729
+ * bar.
730
+ * @param
731
+ */
732
+ function quux () {
733
+
734
+ }
735
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
736
+
737
+ /** @description Foo bar. */
738
+ function quux () {
739
+
740
+ }
741
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
742
+
743
+ /**
744
+ * @description Foo
745
+ * bar.
746
+ */
747
+ function quux () {
748
+
749
+ }
750
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
751
+
752
+ /**
753
+ * Foo. {@see Math.sin}.
754
+ */
755
+ function quux () {
756
+
757
+ }
758
+
759
+ /**
760
+ * Foo {@see Math.sin} bar.
761
+ */
762
+ function quux () {
763
+
764
+ }
765
+
766
+ /**
767
+ * Foo?
768
+ *
769
+ * Bar!
770
+ *
771
+ * Baz:
772
+ * 1. Foo.
773
+ * 2. Bar.
774
+ */
775
+ function quux () {
776
+
777
+ }
778
+
779
+ /**
780
+ * Hello:
781
+ * World.
782
+ */
783
+ function quux () {
784
+
785
+ }
786
+
787
+ /**
788
+ * Hello: world.
789
+ */
790
+ function quux () {
791
+
792
+ }
793
+
794
+ /**
795
+ * Foo
796
+ * Bar.
797
+ */
798
+ function quux () {
799
+
800
+ }
801
+
802
+ /**
803
+ * Foo.
804
+ *
805
+ * foo.
806
+ */
807
+ function quux () {
808
+
809
+ }
810
+
811
+ /**
812
+ * foo.
813
+ */
814
+ function quux () {
815
+
816
+ }
817
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":false}]
818
+
819
+ /**
820
+ * foo.
821
+ */
822
+ class quux {
823
+
824
+ }
825
+
826
+ /**
827
+ * foo.
828
+ */
829
+ class quux {
830
+
831
+ }
832
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":true}]
833
+
834
+ class MyClass {
835
+ /**
836
+ * Abc.
837
+ */
838
+ myClassField = 1
839
+ }
840
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["PropertyDefinition"]}]
841
+
842
+ /**
843
+ * Foo.
844
+ */
845
+ interface quux {
846
+
847
+ }
848
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
849
+
850
+ const myObject = {
851
+ /**
852
+ * Bad description
853
+ */
854
+ myProp: true
855
+ };
856
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
857
+
858
+ /**
859
+ * foo.
860
+ */
861
+ const q = class {
862
+
863
+ }
864
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
865
+
866
+ /**
867
+ * foo.
868
+ */
869
+ const q = {
870
+
871
+ };
872
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
873
+
874
+ /**
875
+ * @description foo.
876
+ */
877
+ function quux () {
878
+
879
+ }
880
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
881
+
882
+ /**
883
+ * Foo.
884
+ *
885
+ * @summary Foo.
886
+ */
887
+ function quux () {
888
+
889
+ }
890
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"summary":true}}]
891
+
892
+ /**
893
+ * Foo.
894
+ *
895
+ * @author Somebody
896
+ */
897
+ function quux () {
898
+
899
+ }
900
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"author":".+"}}]
901
+
902
+ /**
903
+ * Foo.
904
+ *
905
+ * @x-tag something
906
+ */
907
+ function quux () {
908
+
909
+ }
910
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"x-tag":".+"}}]
911
+
912
+ /**
913
+ * Foo.
914
+ *
915
+ * @prop foo Foo.
916
+ */
917
+ function quux (foo) {
918
+
919
+ }
920
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"prop":true}}]
921
+
922
+ /**
923
+ * @param foo Foo bar.
924
+ */
925
+ function quux (foo) {
926
+
927
+ }
928
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
929
+
930
+ /**
931
+ *
932
+ */
933
+ function quux () {
934
+
935
+ }
936
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
937
+
938
+ /**
939
+ * Foo.
940
+ *
941
+ * @template Abc, Def Foo.
942
+ */
943
+ function quux (foo) {
944
+
945
+ }
946
+ // "jsdoc/match-description": ["error"|"warn", {"tags":{"template":true}}]
947
+
948
+ /**
949
+ * Enable or disable plugin.
950
+ *
951
+ * When enabling with this function, the script will be attached to the `document` if:.
952
+ * - the script runs in browser context.
953
+ * - the `document` doesn't have the script already attached.
954
+ * - the `loadScript` option is set to `true`.
955
+ * @param enabled `true` to enable, `false` to disable. Default: `true`.
956
+ */
957
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"],"mainDescription":"/^[A-Z`-].*\\.$/us","matchDescription":"^([A-Z`-].*(\\.|:)|-\\s.*)$","tags":{"param":true,"returns":true}}]
958
+
959
+ /**
960
+ * @constructor
961
+ * @todo Ok.
962
+ */
963
+ function quux () {
964
+ }
965
+ // "jsdoc/match-description": ["error"|"warn", {"mainDescription":false,"tags":{"todo":true}}]
966
+
967
+ /** Does something very important. */
968
+ function foo(): string;
969
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[endLine!=0]"}],"matchDescription":"^\\S[\\s\\S]*\\S$"}]
970
+
971
+ /**
972
+ * This is my favorite function, foo.
973
+ *
974
+ * @returns Nothing.
975
+ */
976
+ function foo(): void;
977
+ // "jsdoc/match-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[endLine!=0]:not(:has(JsdocTag))"}],"matchDescription":"^\\S[\\s\\S]*\\S$"}]
978
+ ````
979
+