eslint-plugin-jsdoc 44.2.3 → 44.2.5

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 (120) hide show
  1. package/dist/WarnSettings.js +0 -1
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js +87 -5
  4. package/dist/alignTransform.js.map +1 -1
  5. package/dist/bin/generateRule.js +4 -3
  6. package/dist/bin/generateRule.js.map +1 -1
  7. package/dist/exportParser.js +272 -71
  8. package/dist/exportParser.js.map +1 -1
  9. package/dist/generateRule.js +4 -3
  10. package/dist/generateRule.js.map +1 -1
  11. package/dist/iterateJsdoc.js +921 -357
  12. package/dist/iterateJsdoc.js.map +1 -1
  13. package/dist/jsdocUtils.js +270 -168
  14. package/dist/jsdocUtils.js.map +1 -1
  15. package/dist/rules/checkAlignment.js +6 -0
  16. package/dist/rules/checkAlignment.js.map +1 -1
  17. package/dist/rules/checkExamples.js +73 -9
  18. package/dist/rules/checkExamples.js.map +1 -1
  19. package/dist/rules/checkIndentation.js +12 -2
  20. package/dist/rules/checkIndentation.js.map +1 -1
  21. package/dist/rules/checkLineAlignment.js +71 -7
  22. package/dist/rules/checkLineAlignment.js.map +1 -1
  23. package/dist/rules/checkParamNames.js +29 -11
  24. package/dist/rules/checkParamNames.js.map +1 -1
  25. package/dist/rules/checkPropertyNames.js +13 -7
  26. package/dist/rules/checkPropertyNames.js.map +1 -1
  27. package/dist/rules/checkTagNames.js +45 -9
  28. package/dist/rules/checkTagNames.js.map +1 -1
  29. package/dist/rules/checkTypes.js +98 -41
  30. package/dist/rules/checkTypes.js.map +1 -1
  31. package/dist/rules/checkValues.js +7 -7
  32. package/dist/rules/checkValues.js.map +1 -1
  33. package/dist/rules/emptyTags.js +8 -1
  34. package/dist/rules/emptyTags.js.map +1 -1
  35. package/dist/rules/informativeDocs.js +27 -8
  36. package/dist/rules/informativeDocs.js.map +1 -1
  37. package/dist/rules/matchDescription.js +18 -1
  38. package/dist/rules/matchDescription.js.map +1 -1
  39. package/dist/rules/matchName.js +2 -2
  40. package/dist/rules/matchName.js.map +1 -1
  41. package/dist/rules/multilineBlocks.js +12 -1
  42. package/dist/rules/multilineBlocks.js.map +1 -1
  43. package/dist/rules/noBadBlocks.js +4 -6
  44. package/dist/rules/noBadBlocks.js.map +1 -1
  45. package/dist/rules/noBlankBlockDescriptions.js +2 -0
  46. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  47. package/dist/rules/noMissingSyntax.js +53 -16
  48. package/dist/rules/noMissingSyntax.js.map +1 -1
  49. package/dist/rules/noMultiAsterisks.js +1 -6
  50. package/dist/rules/noMultiAsterisks.js.map +1 -1
  51. package/dist/rules/noRestrictedSyntax.js +12 -5
  52. package/dist/rules/noRestrictedSyntax.js.map +1 -1
  53. package/dist/rules/noTypes.js +3 -0
  54. package/dist/rules/noTypes.js.map +1 -1
  55. package/dist/rules/noUndefinedTypes.js +65 -27
  56. package/dist/rules/noUndefinedTypes.js.map +1 -1
  57. package/dist/rules/requireAsteriskPrefix.js +20 -0
  58. package/dist/rules/requireAsteriskPrefix.js.map +1 -1
  59. package/dist/rules/requireDescription.js +6 -2
  60. package/dist/rules/requireDescription.js.map +1 -1
  61. package/dist/rules/requireDescriptionCompleteSentence.js +75 -12
  62. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  63. package/dist/rules/requireFileOverview.js +9 -4
  64. package/dist/rules/requireFileOverview.js.map +1 -1
  65. package/dist/rules/requireHyphenBeforeParamDescription.js +21 -7
  66. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  67. package/dist/rules/requireJsdoc.js +150 -29
  68. package/dist/rules/requireJsdoc.js.map +1 -1
  69. package/dist/rules/requireParam.js +116 -10
  70. package/dist/rules/requireParam.js.map +1 -1
  71. package/dist/rules/requireProperty.js +1 -1
  72. package/dist/rules/requireProperty.js.map +1 -1
  73. package/dist/rules/requireReturns.js +2 -3
  74. package/dist/rules/requireReturns.js.map +1 -1
  75. package/dist/rules/requireReturnsCheck.js +9 -2
  76. package/dist/rules/requireReturnsCheck.js.map +1 -1
  77. package/dist/rules/requireThrows.js +2 -3
  78. package/dist/rules/requireThrows.js.map +1 -1
  79. package/dist/rules/requireYields.js +9 -3
  80. package/dist/rules/requireYields.js.map +1 -1
  81. package/dist/rules/requireYieldsCheck.js +19 -5
  82. package/dist/rules/requireYieldsCheck.js.map +1 -1
  83. package/dist/rules/sortTags.js +67 -9
  84. package/dist/rules/sortTags.js.map +1 -1
  85. package/dist/rules/tagLines.js +22 -3
  86. package/dist/rules/tagLines.js.map +1 -1
  87. package/dist/rules/textEscaping.js +18 -4
  88. package/dist/rules/textEscaping.js.map +1 -1
  89. package/dist/rules/validTypes.js +26 -9
  90. package/dist/rules/validTypes.js.map +1 -1
  91. package/dist/tagNames.js +0 -2
  92. package/dist/tagNames.js.map +1 -1
  93. package/dist/utils/hasReturnValue.js +77 -48
  94. package/dist/utils/hasReturnValue.js.map +1 -1
  95. package/docs/rules/check-line-alignment.md +7 -0
  96. package/docs/rules/check-tag-names.md +15 -0
  97. package/docs/rules/no-missing-syntax.md +6 -0
  98. package/docs/rules/no-undefined-types.md +6 -0
  99. package/docs/rules/require-description-complete-sentence.md +525 -289
  100. package/docs/rules/require-description.md +289 -525
  101. package/docs/rules/require-file-overview.md +7 -0
  102. package/docs/rules/require-jsdoc.md +1 -1
  103. package/docs/rules/require-param-description.md +116 -1694
  104. package/docs/rules/require-param-name.md +58 -133
  105. package/docs/rules/require-param-type.md +119 -55
  106. package/docs/rules/require-param.md +1704 -111
  107. package/docs/rules/require-property-description.md +39 -79
  108. package/docs/rules/require-property-name.md +21 -30
  109. package/docs/rules/require-property-type.md +21 -21
  110. package/docs/rules/require-property.md +82 -33
  111. package/docs/rules/require-returns-check.md +636 -747
  112. package/docs/rules/require-returns-description.md +61 -933
  113. package/docs/rules/require-returns-type.md +42 -79
  114. package/docs/rules/require-returns.md +1081 -61
  115. package/docs/rules/require-yields-check.md +238 -517
  116. package/docs/rules/require-yields.md +517 -238
  117. package/docs/rules/valid-types.md +1 -1
  118. package/docs/settings.md +3 -1
  119. package/package.json +10 -9
  120. package/tsconfig.json +2 -3
@@ -1,820 +1,584 @@
1
- <a name="user-content-require-description-complete-sentence"></a>
2
- <a name="require-description-complete-sentence"></a>
3
- # <code>require-description-complete-sentence</code>
4
-
5
- * [Fixer](#user-content-require-description-complete-sentence-fixer)
6
- * [Options](#user-content-require-description-complete-sentence-options)
7
- * [`tags`](#user-content-require-description-complete-sentence-options-tags)
8
- * [`abbreviations`](#user-content-require-description-complete-sentence-options-abbreviations)
9
- * [`newlineBeforeCapsAssumesBadSentenceEnd`](#user-content-require-description-complete-sentence-options-newlinebeforecapsassumesbadsentenceend)
10
- * [Context and settings](#user-content-require-description-complete-sentence-context-and-settings)
11
- * [Failing examples](#user-content-require-description-complete-sentence-failing-examples)
12
- * [Passing examples](#user-content-require-description-complete-sentence-passing-examples)
13
-
14
-
15
- Requires that block description, explicit `@description`, and
16
- `@param`/`@returns` tag descriptions are written in complete sentences, i.e.,
17
-
18
- * Description must start with an uppercase alphabetical character.
19
- * Paragraphs must start with an uppercase alphabetical character.
20
- * Sentences must end with a period, question mark, exclamation mark, or triple backticks.
21
- * Every line in a paragraph (except the first) which starts with an uppercase
22
- character must be preceded by a line ending with a period.
23
- * A colon or semi-colon followed by two line breaks is still part of the
24
- containing paragraph (unlike normal dual line breaks).
25
- * Text within inline tags `{...}` or within triple backticks are not checked for sentence divisions.
26
- * Periods after items within the `abbreviations` option array are not treated
27
- as sentence endings.
28
-
29
- <a name="user-content-require-description-complete-sentence-fixer"></a>
30
- <a name="require-description-complete-sentence-fixer"></a>
31
- ## Fixer
32
-
33
- If sentences do not end with terminal punctuation, a period will be added.
34
-
35
- If sentences do not start with an uppercase character, the initial
36
- letter will be capitalized.
37
-
38
- <a name="user-content-require-description-complete-sentence-options"></a>
39
- <a name="require-description-complete-sentence-options"></a>
40
- ## Options
41
-
42
- <a name="user-content-require-description-complete-sentence-options-tags"></a>
43
- <a name="require-description-complete-sentence-options-tags"></a>
44
- ### <code>tags</code>
45
-
46
- If you want additional tags to be checked for their descriptions, you may
47
- add them within this option.
48
-
49
- ```js
50
- {
51
- 'jsdoc/require-description-complete-sentence': ['error', {
52
- tags: ['see', 'copyright']
53
- }]
54
- }
55
- ```
56
-
57
- The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
58
- parsed to ensure that the checked "description" text includes only the text
59
- after the name.
1
+ <a name="user-content-require-description"></a>
2
+ <a name="require-description"></a>
3
+ # <code>require-description</code>
60
4
 
61
- All other tags will treat the text following the tag name, a space, and
62
- an optional curly-bracketed type expression (and another space) as part of
63
- its "description" (e.g., for `@returns {someType} some description`, the
64
- description is `some description` while for `@some-tag xyz`, the description
65
- is `xyz`).
5
+ * [Options](#user-content-require-description-options)
6
+ * [Context and settings](#user-content-require-description-context-and-settings)
7
+ * [Failing examples](#user-content-require-description-failing-examples)
8
+ * [Passing examples](#user-content-require-description-passing-examples)
66
9
 
67
- <a name="user-content-require-description-complete-sentence-options-abbreviations"></a>
68
- <a name="require-description-complete-sentence-options-abbreviations"></a>
69
- ### <code>abbreviations</code>
70
10
 
71
- You can provide an `abbreviations` options array to avoid such strings of text
72
- being treated as sentence endings when followed by dots. The `.` is not
73
- necessary at the end of the array items.
11
+ Requires that all functions have a description.
74
12
 
75
- <a name="user-content-require-description-complete-sentence-options-newlinebeforecapsassumesbadsentenceend"></a>
76
- <a name="require-description-complete-sentence-options-newlinebeforecapsassumesbadsentenceend"></a>
77
- ### <code>newlineBeforeCapsAssumesBadSentenceEnd</code>
13
+ * All functions must have an implicit description (e.g., text above tags) or
14
+ have the option `descriptionStyle` set to `tag` (requiring `@description`
15
+ (or `@desc` if that is set as your preferred tag name)).
16
+ * Every jsdoc block description (or `@description` tag if `descriptionStyle`
17
+ is `"tag"`) must have a non-empty description that explains the purpose of
18
+ the method.
78
19
 
79
- When `false` (the new default), we will not assume capital letters after
80
- newlines are an incorrect way to end the sentence (they may be proper
81
- nouns, for example).
20
+ <a name="user-content-require-description-options"></a>
21
+ <a name="require-description-options"></a>
22
+ ## Options
82
23
 
83
- <a name="user-content-require-description-complete-sentence-context-and-settings"></a>
84
- <a name="require-description-complete-sentence-context-and-settings"></a>
24
+ An options object may have any of the following properties:
25
+
26
+ - `contexts` - Set to an array of strings representing the AST context
27
+ where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6
28
+ classes). Overrides the default contexts (see below). Set to `"any"` if
29
+ you want the rule to apply to any jsdoc block throughout your files.
30
+ - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
31
+ document block avoids the need for a `@description`. Defaults to an
32
+ array with `inheritdoc`. If you set this array, it will overwrite the
33
+ default, so be sure to add back `inheritdoc` if you wish its presence
34
+ to cause exemption of the rule.
35
+ - `descriptionStyle` - Whether to accept implicit descriptions (`"body"`) or
36
+ `@description` tags (`"tag"`) as satisfying the rule. Set to `"any"` to
37
+ accept either style. Defaults to `"body"`.
38
+ - `checkConstructors` - A value indicating whether `constructor`s should be
39
+ checked. Defaults to `true`.
40
+ - `checkGetters` - A value indicating whether getters should be checked.
41
+ Defaults to `true`.
42
+ - `checkSetters` - A value indicating whether setters should be checked.
43
+ Defaults to `true`.
44
+
45
+ <a name="user-content-require-description-context-and-settings"></a>
46
+ <a name="require-description-context-and-settings"></a>
85
47
  ## Context and settings
86
48
 
87
- |||
88
- |---|---|
89
- |Context|everywhere|
90
- |Tags|doc block, `param`, `returns`, `description`, `property`, `summary`, `file`, `classdesc`, `todo`, `deprecated`, `throws`, 'yields' and others added by `tags`|
91
- |Aliases|`arg`, `argument`, `return`, `desc`, `prop`, `fileoverview`, `overview`, `exception`, `yield`|
92
- |Recommended|false|
93
- |Options|`tags`, `abbreviations`, `newlineBeforeCapsAssumesBadSentenceEnd`|
94
-
95
- <a name="user-content-require-description-complete-sentence-failing-examples"></a>
96
- <a name="require-description-complete-sentence-failing-examples"></a>
49
+ | | |
50
+ | -------- | ---------------------- |
51
+ | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
52
+ | Tags | `description` or jsdoc block |
53
+ | Aliases | `desc` |
54
+ | Recommended | false |
55
+ | Options | `contexts`, `exemptedBy`, `descriptionStyle`, `checkConstructors`, `checkGetters`, `checkSetters` |
56
+ | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
57
+
58
+ <a name="user-content-require-description-failing-examples"></a>
59
+ <a name="require-description-failing-examples"></a>
97
60
  ## Failing examples
98
61
 
99
62
  The following patterns are considered problems:
100
63
 
101
64
  ````js
102
65
  /**
103
- * foo.
104
- */
105
- function quux () {
106
-
107
- }
108
- // Message: Sentences should start with an uppercase character.
109
-
110
- /**
111
- * foo?
112
- */
113
- function quux () {
114
-
115
- }
116
- // Message: Sentences should start with an uppercase character.
117
-
118
- /**
119
- * @description foo.
120
- */
121
- function quux () {
122
-
123
- }
124
- // Message: Sentences should start with an uppercase character.
125
-
126
- /**
127
- * Foo)
66
+ *
128
67
  */
129
68
  function quux () {
130
69
 
131
70
  }
132
- // Message: Sentences must end with a period.
71
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
72
+ // Message: Missing JSDoc @description declaration.
133
73
 
134
74
  /**
135
- * `foo` is a variable
75
+ *
136
76
  */
137
77
  function quux () {
138
78
 
139
79
  }
140
- // Message: Sentences must end with a period.
80
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
81
+ // Message: Missing JSDoc block description or @description declaration.
141
82
 
142
83
  /**
143
- * Foo.
144
84
  *
145
- * foo.
146
85
  */
147
86
  function quux () {
148
87
 
149
88
  }
150
- // Message: Sentences should start with an uppercase character.
89
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
90
+ // Message: Missing JSDoc block description.
151
91
 
152
92
  /**
153
- * тест.
93
+ * @desc Not a blank description
154
94
  */
155
95
  function quux () {
156
96
 
157
97
  }
158
- // Message: Sentences should start with an uppercase character.
98
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
99
+ // Message: Remove the @desc tag to leave a plain block description or add additional description text above the @desc line.
159
100
 
160
101
  /**
161
- * Foo
102
+ * @description Not a blank description
162
103
  */
163
104
  function quux () {
164
105
 
165
106
  }
166
- // Message: Sentences must end with a period.
107
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
108
+ // Message: Remove the @description tag to leave a plain block description or add additional description text above the @description line.
167
109
 
168
110
  /**
169
- * Foo
170
111
  *
171
- * @param x
172
112
  */
173
- function quux () {
113
+ class quux {
174
114
 
175
115
  }
176
- // Message: Sentences must end with a period.
116
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
117
+ // Message: Missing JSDoc @description declaration.
177
118
 
178
119
  /**
179
- * Foo
180
- * Bar.
181
- */
182
- function quux () {
183
-
184
- }
185
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"newlineBeforeCapsAssumesBadSentenceEnd":true}]
186
- // Message: A line of text is started with an uppercase character, but the preceding line does not end the sentence.
187
-
188
- /**
189
- * Foo.
190
120
  *
191
- * @param foo foo.
192
121
  */
193
- function quux (foo) {
122
+ class quux {
194
123
 
195
124
  }
196
- // Message: Sentences should start with an uppercase character.
125
+ // Settings: {"jsdoc":{"contexts":["ClassDeclaration"]}}
126
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
127
+ // Message: Missing JSDoc @description declaration.
197
128
 
198
129
  /**
199
- * Foo.
200
130
  *
201
- * @param foo bar
202
131
  */
203
- function quux (foo) {
204
-
205
- }
206
- // Message: Sentences should start with an uppercase character.
132
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["any"],"descriptionStyle":"tag"}]
133
+ // Message: Missing JSDoc @description declaration.
207
134
 
208
135
  /**
209
- * {@see Foo.bar} buz
210
- */
211
- function quux (foo) {
212
-
213
- }
214
- // Message: Sentences should start with an uppercase character.
215
-
216
- /**
217
- * Foo.
218
136
  *
219
- * @returns {number} foo
220
137
  */
221
- function quux (foo) {
138
+ class quux {
222
139
 
223
140
  }
224
- // Message: Sentences should start with an uppercase character.
141
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
142
+ // Message: Missing JSDoc @description declaration.
225
143
 
226
144
  /**
227
- * Foo.
228
145
  *
229
- * @returns foo.
230
146
  */
231
- function quux (foo) {
147
+ class quux {
232
148
 
233
149
  }
234
- // Message: Sentences should start with an uppercase character.
150
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
151
+ // Message: Missing JSDoc @description declaration.
235
152
 
236
153
  /**
237
- * lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque elit diam,
238
- * iaculis eu dignissim sed, ultrices sed nisi. nulla at ligula auctor, consectetur neque sed,
239
- * tincidunt nibh. vivamus sit amet vulputate ligula. vivamus interdum elementum nisl,
240
- * vitae rutrum tortor semper ut. morbi porta ante vitae dictum fermentum.
241
- * proin ut nulla at quam convallis gravida in id elit. sed dolor mauris, blandit quis ante at,
242
- * consequat auctor magna. duis pharetra purus in porttitor mollis.
154
+ * @description
243
155
  */
244
- function longDescription (foo) {
245
-
246
- }
247
- // Message: Sentences should start with an uppercase character.
248
-
249
- /**
250
- * @arg {number} foo - Foo
251
- */
252
- function quux (foo) {
156
+ function quux () {
253
157
 
254
158
  }
255
- // Message: Sentences must end with a period.
159
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
160
+ // Message: Missing JSDoc @description description.
256
161
 
257
162
  /**
258
- * @argument {number} foo - Foo
163
+ *
259
164
  */
260
- function quux (foo) {
165
+ interface quux {
261
166
 
262
167
  }
263
- // Message: Sentences must end with a period.
168
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"],"descriptionStyle":"tag"}]
169
+ // Message: Missing JSDoc @description declaration.
264
170
 
265
171
  /**
266
- * @return {number} foo
172
+ *
267
173
  */
268
- function quux (foo) {
174
+ var quux = class {
269
175
 
270
- }
271
- // Message: Sentences should start with an uppercase character.
176
+ };
177
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassExpression"],"descriptionStyle":"tag"}]
178
+ // Message: Missing JSDoc @description declaration.
272
179
 
273
180
  /**
274
- * Returns bar.
275
181
  *
276
- * @return {number} bar
277
182
  */
278
- function quux (foo) {
279
-
280
- }
281
- // Message: Sentences should start with an uppercase character.
183
+ var quux = {
282
184
 
283
- /**
284
- * @throws {object} Hello World
285
- * hello world
286
- */
287
- // Message: Sentences must end with a period.
185
+ };
186
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ObjectExpression"],"descriptionStyle":"tag"}]
187
+ // Message: Missing JSDoc @description declaration.
288
188
 
289
189
  /**
290
- * @summary Foo
190
+ * @someDesc
291
191
  */
292
192
  function quux () {
293
193
 
294
194
  }
295
- // Message: Sentences must end with a period.
195
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":{"message":"Please avoid `{{tagName}}`; use `{{replacement}}` instead","replacement":"someDesc"}}}}
196
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
197
+ // Message: Missing JSDoc @someDesc description.
296
198
 
297
199
  /**
298
- * @throws {SomeType} Foo
200
+ * @description
299
201
  */
300
202
  function quux () {
301
203
 
302
204
  }
303
- // Message: Sentences must end with a period.
205
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
206
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
207
+ // Message: Unexpected tag `@description`
304
208
 
305
209
  /**
306
- * @see Foo
210
+ * @description
307
211
  */
308
212
  function quux () {
309
213
 
310
- }
311
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["see"]}]
312
- // Message: Sentences must end with a period.
313
-
314
- /**
315
- * @param foo Foo bar
316
- */
317
- function quux (foo) {
318
-
319
214
  }
320
215
  // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
321
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
322
- // Message: Sentences must end with a period.
216
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
217
+ // Message: Missing JSDoc block description or @description declaration.
323
218
 
324
219
  /**
325
- * Sorry, but this isn't a complete sentence, Mr.
220
+ *
326
221
  */
327
222
  function quux () {
328
-
329
223
  }
330
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
331
- // Message: Sentences must end with a period.
224
+ // "jsdoc/require-description": ["error"|"warn", {"exemptedBy":["notPresent"]}]
225
+ // Message: Missing JSDoc block description.
332
226
 
333
- /**
334
- * Sorry, but this isn't a complete sentence Mr.
335
- */
336
- function quux () {
227
+ class TestClass {
228
+ /**
229
+ *
230
+ */
231
+ constructor() { }
232
+ }
233
+ // Message: Missing JSDoc block description.
337
234
 
235
+ class TestClass {
236
+ /**
237
+ *
238
+ */
239
+ constructor() { }
338
240
  }
339
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr."]}]
340
- // Message: Sentences must end with a period.
241
+ // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":true}]
242
+ // Message: Missing JSDoc block description.
341
243
 
342
- /**
343
- * Sorry, but this isn't a complete sentence Mr.
344
- */
345
- function quux () {
244
+ class TestClass {
245
+ /**
246
+ *
247
+ */
248
+ get Test() { }
249
+ }
250
+ // Message: Missing JSDoc block description.
346
251
 
252
+ class TestClass {
253
+ /**
254
+ *
255
+ */
256
+ get Test() { }
347
257
  }
348
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
349
- // Message: Sentences must end with a period.
258
+ // "jsdoc/require-description": ["error"|"warn", {"checkGetters":true}]
259
+ // Message: Missing JSDoc block description.
350
260
 
351
- /**
352
- * Sorry, but this isn't a complete sentence Mr. and Mrs.
353
- */
354
- function quux () {
261
+ class TestClass {
262
+ /**
263
+ *
264
+ */
265
+ set Test(value) { }
266
+ }
267
+ // Message: Missing JSDoc block description.
355
268
 
269
+ class TestClass {
270
+ /**
271
+ *
272
+ */
273
+ set Test(value) { }
356
274
  }
357
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr","Mrs"]}]
358
- // Message: Sentences must end with a period.
275
+ // "jsdoc/require-description": ["error"|"warn", {"checkSetters":true}]
276
+ // Message: Missing JSDoc block description.
359
277
 
360
278
  /**
361
- * This is a complete sentence. But this isn't, Mr.
279
+ *
362
280
  */
363
- function quux () {
281
+ class Foo {
282
+ /**
283
+ *
284
+ */
285
+ constructor() {}
364
286
 
287
+ /**
288
+ *
289
+ */
290
+ bar() {}
365
291
  }
366
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
367
- // Message: Sentences must end with a period.
292
+ // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":false,"contexts":["MethodDefinition"]}]
293
+ // Message: Missing JSDoc block description.
368
294
 
369
295
  /**
370
- * This is a complete Mr. sentence. But this isn't, Mr.
296
+ * @implements {Bar}
371
297
  */
372
- function quux () {
298
+ class quux {
373
299
 
374
300
  }
375
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
376
- // Message: Sentences must end with a period.
301
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
302
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"Bar\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
303
+ // Message: Missing JSDoc @description declaration.
377
304
 
378
305
  /**
379
- * This is a complete Mr. sentence.
306
+ * Has some
307
+ * description already.
308
+ * @implements {Bar}
380
309
  */
381
- function quux () {
310
+ class quux {
382
311
 
383
312
  }
384
- // Message: Sentences should start with an uppercase character.
313
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
314
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"Bar\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
315
+ // Message: Missing JSDoc @description declaration.
385
316
 
386
317
  /**
387
- * This is fun, i.e. enjoyable, but not superlatively so, e.g. not
388
- * super, wonderful, etc..
318
+ * @implements {Bar
319
+ * | Foo}
389
320
  */
390
- function quux () {
321
+ class quux {
391
322
 
392
323
  }
393
- // Message: Sentences should start with an uppercase character.
324
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
325
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
326
+ // Message: Missing JSDoc @description declaration.
394
327
 
395
328
  /**
396
- * Do not have dynamic content; e.g. homepage. Here a simple unique id
397
- * suffices.
329
+ * @implements {Bar}
398
330
  */
399
- function quux () {
400
-
401
- }
402
- // Message: Sentences should start with an uppercase character.
331
+ class quux {
403
332
 
404
- /**
405
- * Implements support for the
406
- * Swahili voice synthesizer.
407
- */
408
- function speak() {
409
333
  }
410
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"newlineBeforeCapsAssumesBadSentenceEnd":true}]
411
- // Message: A line of text is started with an uppercase character, but the preceding line does not end the sentence.
334
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
335
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
336
+ // Message: Missing JSDoc @description declaration.
412
337
 
413
338
  /**
414
- * Foo.
415
- *
416
- * @template TempA, TempB foo.
339
+ * @implements {Bar}
417
340
  */
418
- function quux (foo) {
341
+ class quux {
419
342
 
420
343
  }
421
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["template"]}]
422
- // Message: Sentences should start with an uppercase character.
423
-
424
- /**
425
- * Just a component.
426
- * @param {Object} props Свойства.
427
- * @return {ReactElement}.
428
- */
429
- function quux () {}
430
- // Message: Sentences must be more than punctuation.
344
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
345
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"any"}],"descriptionStyle":"tag"}]
346
+ // Message: Missing JSDoc @description declaration.
431
347
  ````
432
348
 
433
349
 
434
350
 
435
- <a name="user-content-require-description-complete-sentence-passing-examples"></a>
436
- <a name="require-description-complete-sentence-passing-examples"></a>
351
+ <a name="user-content-require-description-passing-examples"></a>
352
+ <a name="require-description-passing-examples"></a>
437
353
  ## Passing examples
438
354
 
439
355
  The following patterns are not considered problems:
440
356
 
441
357
  ````js
442
358
  /**
443
- * @param foo - Foo.
444
- */
445
- function quux () {
446
-
447
- }
448
-
449
- /**
450
- * Foo.
451
- */
452
- function quux () {
453
-
454
- }
455
-
456
- /**
457
- * Foo.
458
- * Bar.
459
- */
460
- function quux () {
461
-
462
- }
463
-
464
- /**
465
- * Foo.
466
359
  *
467
- * Bar.
468
- */
469
- function quux () {
470
-
471
- }
472
-
473
- /**
474
- * Тест.
475
360
  */
476
- function quux () {
477
-
478
- }
479
-
480
- /**
481
- * Foo
482
- * bar.
483
- */
484
- function quux () {
485
-
486
- }
487
361
 
488
362
  /**
489
- * @returns Foo bar.
363
+ * @description
364
+ * // arbitrary description content
490
365
  */
491
366
  function quux () {
492
367
 
493
368
  }
369
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
494
370
 
495
371
  /**
496
- * Foo {@see Math.sin}.
372
+ * @description
373
+ * quux(); // does something useful
497
374
  */
498
375
  function quux () {
499
376
 
500
377
  }
378
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
501
379
 
502
380
  /**
503
- * Foo {@see Math.sin} bar.
381
+ * @description <caption>Valid usage</caption>
382
+ * quux(); // does something useful
383
+ *
384
+ * @description <caption>Invalid usage</caption>
385
+ * quux('random unwanted arg'); // results in an error
504
386
  */
505
387
  function quux () {
506
388
 
507
389
  }
390
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
508
391
 
509
392
  /**
510
- * Foo?
511
- *
512
- * Bar!
513
393
  *
514
- * Baz:
515
- * 1. Foo.
516
- * 2. Bar.
517
394
  */
518
- function quux () {
395
+ class quux {
519
396
 
520
397
  }
398
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
521
399
 
522
400
  /**
523
- * Hello:
524
- * World.
401
+ *
525
402
  */
526
403
  function quux () {
527
404
 
528
405
  }
406
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
529
407
 
530
408
  /**
531
- * Hello: world.
409
+ * @type {MyCallback}
532
410
  */
533
411
  function quux () {
534
412
 
535
413
  }
414
+ // "jsdoc/require-description": ["error"|"warn", {"exemptedBy":["type"]}]
536
415
 
537
416
  /**
538
417
  *
539
418
  */
540
- function quux () {
419
+ interface quux {
541
420
 
542
421
  }
422
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
543
423
 
544
- /**
545
- * @description Foo.
546
- */
547
- function quux () {
548
-
549
- }
550
-
551
- /**
552
- * `foo` is a variable.
553
- */
554
- function quux () {
555
-
424
+ interface quux {
425
+ /**
426
+ * If the thing should be checked.
427
+ */
428
+ checked?: boolean
556
429
  }
430
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":["TSPropertySignature"]}]
557
431
 
558
432
  /**
559
- * Foo.
560
433
  *
561
- * `foo`.
562
434
  */
563
- function quux () {
435
+ var quux = class {
564
436
 
565
- }
437
+ };
438
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
566
439
 
567
440
  /**
568
- * @param foo - `bar`.
441
+ *
569
442
  */
570
- function quux () {
443
+ var quux = {
571
444
 
572
- }
445
+ };
446
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
573
447
 
574
448
  /**
575
- * @returns {number} `foo`.
449
+ * Has an implicit description
576
450
  */
577
451
  function quux () {
578
452
 
579
453
  }
454
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
580
455
 
581
456
  /**
582
- * Foo
583
- * `bar`.
457
+ * Has an implicit description
584
458
  */
585
459
  function quux () {
586
460
 
587
461
  }
588
462
 
589
463
  /**
590
- * @example Foo
464
+ * Has an implicit description
591
465
  */
592
466
  function quux () {
593
467
 
594
468
  }
469
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
595
470
 
596
471
  /**
597
- * @see Foo
472
+ * @description Has an explicit description
598
473
  */
599
474
  function quux () {
600
475
 
601
476
  }
477
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
602
478
 
603
479
  /**
604
- * Foo.
605
480
  *
606
- * @param foo Foo.
607
- */
608
- function quux (foo) {
609
-
610
- }
611
-
612
- /**
613
- * Foo.
614
- *
615
- * @param foo Foo.
616
- */
617
- function quux (foo) {
618
-
619
- }
620
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
621
-
622
- /**
623
- * @param foo Foo bar.
624
- */
625
- function quux (foo) {
626
-
627
- }
628
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
629
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
630
-
631
- /**
632
- *
633
- */
634
- function quux (foo) {
635
-
636
- }
637
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
638
-
639
- /**
640
- * We stop loading Items when we have loaded:
641
- *
642
- * 1) The main Item;
643
- * 2) All its variants.
644
- */
645
-
646
- /**
647
- * This method is working on 2 steps.
648
- *
649
- * | Step | Comment |
650
- * |------|-------------|
651
- * | 1 | do it |
652
- * | 2 | do it again |
653
- */
654
-
655
- /**
656
- * This is something that
657
- * I want to test.
658
481
  */
659
482
  function quux () {
660
483
 
661
484
  }
485
+ // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
662
486
 
663
- /**
664
- * When making HTTP requests, the
665
- * URL is super important.
666
- */
667
- function quux () {
668
-
669
- }
670
-
671
- /**
672
- * Sorry, but this isn't a complete sentence, Mr.
673
- */
674
- function quux () {
675
-
487
+ class TestClass {
488
+ /**
489
+ * Test.
490
+ */
491
+ constructor() { }
676
492
  }
677
493
 
678
- /**
679
- * Sorry, but this isn't a complete sentence Mr..
680
- */
681
- function quux () {
682
-
494
+ class TestClass {
495
+ /**
496
+ *
497
+ */
498
+ constructor() { }
683
499
  }
684
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr."]}]
685
-
686
- /**
687
- * Sorry, but this isn't a complete sentence Mr.
688
- */
689
- function quux () {
500
+ // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":false}]
690
501
 
502
+ class TestClass {
503
+ /**
504
+ * Test.
505
+ */
506
+ get Test() { }
691
507
  }
692
508
 
693
- /**
694
- * Sorry, but this isn't a complete sentence Mr. and Mrs..
695
- */
696
- function quux () {
697
-
698
- }
699
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr","Mrs"]}]
700
-
701
- /**
702
- * This is a complete sentence aMr.
703
- */
704
- function quux () {
705
-
509
+ class TestClass {
510
+ /**
511
+ *
512
+ */
513
+ get Test() { }
706
514
  }
707
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
708
-
709
- /**
710
- * This is a complete sentence. But this isn't, Mr.
711
- */
712
- function quux () {
515
+ // "jsdoc/require-description": ["error"|"warn", {"checkGetters":false}]
713
516
 
517
+ class TestClass {
518
+ /**
519
+ * Test.
520
+ */
521
+ set Test(value) { }
714
522
  }
715
523
 
716
- /**
717
- * This is a complete Mr. Sentence. But this isn't, Mr.
718
- */
719
- function quux () {
720
-
524
+ class TestClass {
525
+ /**
526
+ *
527
+ */
528
+ set Test(value) { }
721
529
  }
530
+ // "jsdoc/require-description": ["error"|"warn", {"checkSetters":false}]
722
531
 
723
532
  /**
724
- * This is a complete Mr. sentence.
533
+ * Multi
534
+ * line
725
535
  */
726
536
  function quux () {
727
537
 
728
538
  }
729
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
730
539
 
731
- /**
732
- * This is fun, i.e. enjoyable, but not superlatively so, e.g. not
733
- * super, wonderful, etc..
734
- */
540
+ /** Single line */
735
541
  function quux () {
736
542
 
737
543
  }
738
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["etc","e.g.","i.e."]}]
739
-
740
544
 
741
- **
742
- * Do not have dynamic content; e.g. homepage. Here a simple unique id
743
- * suffices.
744
- */
545
+ /** @description something */
745
546
  function quux () {
746
547
 
747
548
  }
748
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["etc","e.g.","i.e."]}]
549
+ // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
749
550
 
750
551
  /**
751
- * Implements support for the
752
- * Swahili voice synthesizer.
552
+ * @implements {Bar}
753
553
  */
754
- function speak() {
755
- }
554
+ class quux {
756
555
 
757
- /**
758
- * @param foo
759
- *
760
- * @returns {void}
761
- */
762
- export default (foo) => {
763
- foo()
764
556
  }
765
-
766
- /** @file To learn more,
767
- * see: https://github.com/d3/d3-ease. */
768
-
769
- /** To learn more,
770
- * see: https://github.com/d3/d3-ease. */
557
+ // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
558
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=/\\s{4}/]:has(JsdocTag[rawType=\"class\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
771
559
 
772
560
  /**
773
- * This is a complete sentence...
561
+ * Has some
562
+ * description already.
774
563
  */
775
- function quux () {
564
+ class quux {
776
565
 
777
566
  }
567
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
778
568
 
779
569
  /**
780
- * He wanted a few items: a jacket and shirt...
570
+ * Has some
571
+ * description already.
781
572
  */
782
- function quux () {
573
+ class quux {
783
574
 
784
575
  }
576
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]
785
577
 
786
578
  /**
787
- * The code in question was...
788
- * ```
789
- * alert('hello');
790
- * ```
579
+ * Has some
580
+ * description already.
791
581
  */
792
- function quux () {
793
-
794
- }
795
-
796
- /**
797
- * @param {number|string|Date|Object|OverType|WhateverElse} multiType -
798
- * Nice long explanation...
799
- */
800
- function test (multiType) {
801
- }
802
-
803
- /**
804
- * Any kind of fowl (e.g., a duck).
805
- */
806
- function quux () {}
807
-
808
- /**
809
- * The code in question was...
810
- * ```
811
- * do something
812
- *
813
- * interesting
814
- * ```
815
- */
816
- function quux () {
817
-
818
- }
582
+ // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]
819
583
  ````
820
584