eslint-plugin-jsdoc 46.4.5 → 46.5.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 (66) hide show
  1. package/README.md +31 -0
  2. package/dist/alignTransform.js +5 -5
  3. package/dist/alignTransform.js.map +1 -1
  4. package/dist/index.js +21 -10
  5. package/dist/index.js.map +1 -1
  6. package/dist/iterateJsdoc.js +1 -1
  7. package/dist/iterateJsdoc.js.map +1 -1
  8. package/dist/rules/checkExamples.js +12 -6
  9. package/dist/rules/checkExamples.js.map +1 -1
  10. package/package.json +19 -15
  11. package/docs/advanced.md +0 -102
  12. package/docs/rules/check-access.md +0 -193
  13. package/docs/rules/check-alignment.md +0 -169
  14. package/docs/rules/check-examples.md +0 -784
  15. package/docs/rules/check-indentation.md +0 -296
  16. package/docs/rules/check-line-alignment.md +0 -1002
  17. package/docs/rules/check-param-names.md +0 -1035
  18. package/docs/rules/check-property-names.md +0 -244
  19. package/docs/rules/check-syntax.md +0 -80
  20. package/docs/rules/check-tag-names.md +0 -1132
  21. package/docs/rules/check-types.md +0 -1198
  22. package/docs/rules/check-values.md +0 -409
  23. package/docs/rules/empty-tags.md +0 -220
  24. package/docs/rules/implements-on-classes.md +0 -219
  25. package/docs/rules/imports-as-dependencies.md +0 -99
  26. package/docs/rules/informative-docs.md +0 -400
  27. package/docs/rules/match-description.md +0 -1008
  28. package/docs/rules/match-name.md +0 -249
  29. package/docs/rules/multiline-blocks.md +0 -398
  30. package/docs/rules/no-bad-blocks.md +0 -174
  31. package/docs/rules/no-blank-block-descriptions.md +0 -91
  32. package/docs/rules/no-blank-blocks.md +0 -98
  33. package/docs/rules/no-defaults.md +0 -207
  34. package/docs/rules/no-missing-syntax.md +0 -275
  35. package/docs/rules/no-multi-asterisks.md +0 -278
  36. package/docs/rules/no-restricted-syntax.md +0 -383
  37. package/docs/rules/no-types.md +0 -168
  38. package/docs/rules/no-undefined-types.md +0 -789
  39. package/docs/rules/require-asterisk-prefix.md +0 -297
  40. package/docs/rules/require-description-complete-sentence.md +0 -820
  41. package/docs/rules/require-description.md +0 -585
  42. package/docs/rules/require-example.md +0 -390
  43. package/docs/rules/require-file-overview.md +0 -324
  44. package/docs/rules/require-hyphen-before-param-description.md +0 -281
  45. package/docs/rules/require-jsdoc.md +0 -1857
  46. package/docs/rules/require-param-description.md +0 -238
  47. package/docs/rules/require-param-name.md +0 -163
  48. package/docs/rules/require-param-type.md +0 -227
  49. package/docs/rules/require-param.md +0 -1820
  50. package/docs/rules/require-property-description.md +0 -88
  51. package/docs/rules/require-property-name.md +0 -79
  52. package/docs/rules/require-property-type.md +0 -79
  53. package/docs/rules/require-property.md +0 -128
  54. package/docs/rules/require-returns-check.md +0 -1053
  55. package/docs/rules/require-returns-description.md +0 -181
  56. package/docs/rules/require-returns-type.md +0 -144
  57. package/docs/rules/require-returns.md +0 -1191
  58. package/docs/rules/require-throws.md +0 -326
  59. package/docs/rules/require-yields-check.md +0 -544
  60. package/docs/rules/require-yields.md +0 -823
  61. package/docs/rules/sort-tags.md +0 -635
  62. package/docs/rules/tag-lines.md +0 -551
  63. package/docs/rules/text-escaping.md +0 -177
  64. package/docs/rules/valid-types.md +0 -881
  65. package/docs/settings.md +0 -362
  66. package/tsconfig.json +0 -22
@@ -1,326 +0,0 @@
1
- <a name="user-content-require-throws"></a>
2
- <a name="require-throws"></a>
3
- # <code>require-throws</code>
4
-
5
- * [Options](#user-content-require-throws-options)
6
- * [Context and settings](#user-content-require-throws-context-and-settings)
7
- * [Failing examples](#user-content-require-throws-failing-examples)
8
- * [Passing examples](#user-content-require-throws-passing-examples)
9
-
10
-
11
- Requires that throw statements are documented.
12
-
13
- Note that since throw statements within async functions end up as rejected
14
- Promises, they are not considered as throw statements for the purposes of this
15
- rule. See [issue 755](https://github.com/gajus/eslint-plugin-jsdoc/issues/755)
16
- for our desire for a separate tag to document rejection types and see
17
- [this discussion](https://stackoverflow.com/questions/50071115/typescript-promise-rejection-type)
18
- on why TypeScript doesn't offer such a feature.
19
-
20
- <a name="user-content-require-throws-options"></a>
21
- <a name="require-throws-options"></a>
22
- ## Options
23
-
24
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
25
- document block avoids the need for a `@throws`. Defaults to an array
26
- with `inheritdoc`. If you set this array, it will overwrite the default,
27
- so be sure to add back `inheritdoc` if you wish its presence to cause
28
- exemption of the rule.
29
- - `contexts` - Set this to an array of strings representing the AST context
30
- (or an object with `context` and `comment` properties) where you wish
31
- the rule to be applied.
32
- Overrides the default contexts (see below). Set to `"any"` if you want
33
- the rule to apply to any jsdoc block throughout your files (as is necessary
34
- for finding function blocks not attached to a function declaration or
35
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
36
- `@method`) (including those associated with an `@interface`).
37
-
38
- ```js
39
- 'jsdoc/require-throws': 'error',
40
- ```
41
-
42
- <a name="user-content-require-throws-context-and-settings"></a>
43
- <a name="require-throws-context-and-settings"></a>
44
- ## Context and settings
45
-
46
- | | |
47
- | -------- | --- |
48
- | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
49
- | Tags | `throws` |
50
- | Aliases | `exception` |
51
- |Recommended|true|
52
- | Options |`contexts`, `exemptedBy`|
53
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
54
-
55
- <a name="user-content-require-throws-failing-examples"></a>
56
- <a name="require-throws-failing-examples"></a>
57
- ## Failing examples
58
-
59
- The following patterns are considered problems:
60
-
61
- ````js
62
- /**
63
- *
64
- */
65
- function quux (foo) {
66
- throw new Error('err')
67
- }
68
- // Message: Missing JSDoc @throws declaration.
69
-
70
- /**
71
- *
72
- */
73
- const quux = function (foo) {
74
- throw new Error('err')
75
- }
76
- // Message: Missing JSDoc @throws declaration.
77
-
78
- /**
79
- *
80
- */
81
- const quux = (foo) => {
82
- throw new Error('err')
83
- }
84
- // Message: Missing JSDoc @throws declaration.
85
-
86
- /**
87
- *
88
- */
89
- function quux (foo) {
90
- while(true) {
91
- throw new Error('err')
92
- }
93
- }
94
- // Message: Missing JSDoc @throws declaration.
95
-
96
- /**
97
- *
98
- */
99
- function quux (foo) {
100
- do {
101
- throw new Error('err')
102
- } while(true)
103
- }
104
- // Message: Missing JSDoc @throws declaration.
105
-
106
- /**
107
- *
108
- */
109
- function quux (foo) {
110
- for(var i = 0; i <= 10; i++) {
111
- throw new Error('err')
112
- }
113
- }
114
- // Message: Missing JSDoc @throws declaration.
115
-
116
- /**
117
- *
118
- */
119
- function quux (foo) {
120
- for(num in [1,2,3]) {
121
- throw new Error('err')
122
- }
123
- }
124
- // Message: Missing JSDoc @throws declaration.
125
-
126
- /**
127
- *
128
- */
129
- function quux (foo) {
130
- for(const num of [1,2,3]) {
131
- throw new Error('err')
132
- }
133
- }
134
- // Message: Missing JSDoc @throws declaration.
135
-
136
- /**
137
- *
138
- */
139
- function quux (foo) {
140
- for(const index in [1,2,3]) {
141
- throw new Error('err')
142
- }
143
- }
144
- // Message: Missing JSDoc @throws declaration.
145
-
146
- /**
147
- *
148
- */
149
- function quux (foo) {
150
- with(foo) {
151
- throw new Error('err')
152
- }
153
- }
154
- // Message: Missing JSDoc @throws declaration.
155
-
156
- /**
157
- *
158
- */
159
- function quux (foo) {
160
- if (true) {
161
- throw new Error('err')
162
- }
163
- }
164
- // Message: Missing JSDoc @throws declaration.
165
-
166
- /**
167
- *
168
- */
169
- function quux (foo) {
170
- if (false) {
171
- // do nothing
172
- } else {
173
- throw new Error('err')
174
- }
175
- }
176
- // Message: Missing JSDoc @throws declaration.
177
-
178
- /**
179
- *
180
- */
181
- function quux (foo) {
182
- try {
183
- throw new Error('err')
184
- } catch(e) {
185
- throw new Error(e.message)
186
- }
187
- }
188
- // Message: Missing JSDoc @throws declaration.
189
-
190
- /**
191
- *
192
- */
193
- function quux (foo) {
194
- try {
195
- // do nothing
196
- } finally {
197
- throw new Error(e.message)
198
- }
199
- }
200
- // Message: Missing JSDoc @throws declaration.
201
-
202
- /**
203
- *
204
- */
205
- function quux (foo) {
206
- const a = 'b'
207
- switch(a) {
208
- case 'b':
209
- throw new Error('err')
210
- }
211
- }
212
- // Message: Missing JSDoc @throws declaration.
213
-
214
- /**
215
- * @throws
216
- */
217
- function quux () {
218
-
219
- }
220
- // Settings: {"jsdoc":{"tagNamePreference":{"throws":false}}}
221
- // Message: Unexpected tag `@throws`
222
-
223
- /**
224
- *
225
- */
226
- const directThrowAfterArrow = (b) => {
227
- const a = () => {};
228
- if (b) {
229
- throw new Error('oops')
230
- }
231
- return a;
232
- };
233
- // Message: Missing JSDoc @throws declaration.
234
-
235
- /**
236
- * @throws {never}
237
- */
238
- function quux (foo) {
239
- throw new Error('err')
240
- }
241
- // Message: JSDoc @throws declaration set to "never" but throw value found.
242
- ````
243
-
244
-
245
-
246
- <a name="user-content-require-throws-passing-examples"></a>
247
- <a name="require-throws-passing-examples"></a>
248
- ## Passing examples
249
-
250
- The following patterns are not considered problems:
251
-
252
- ````js
253
- /**
254
- * @throws An error.
255
- */
256
- function quux () {
257
- throw new Error('err')
258
- }
259
-
260
- /**
261
- *
262
- */
263
- function quux (foo) {
264
- try {
265
- throw new Error('err')
266
- } catch(e) {}
267
- }
268
-
269
- /**
270
- * @throws {object}
271
- */
272
- function quux (foo) {
273
- throw new Error('err')
274
- }
275
-
276
- /**
277
- * @inheritdoc
278
- */
279
- function quux (foo) {
280
- throw new Error('err')
281
- }
282
-
283
- /**
284
- * @abstract
285
- */
286
- function quux (foo) {
287
- throw new Error('err')
288
- }
289
-
290
- /**
291
- *
292
- */
293
- function quux (foo) {
294
- }
295
-
296
- /**
297
- * @type {MyCallback}
298
- */
299
- function quux () {
300
- throw new Error('err')
301
- }
302
- // "jsdoc/require-throws": ["error"|"warn", {"exemptedBy":["type"]}]
303
-
304
- /**
305
- *
306
- */
307
- const itself = (n) => n;
308
-
309
- /**
310
- * Not tracking on nested function
311
- */
312
- const nested = () => () => {throw new Error('oops');};
313
-
314
- /**
315
- */
316
- async function foo() {
317
- throw Error("bar");
318
- }
319
-
320
- /**
321
- * @throws {never}
322
- */
323
- function quux (foo) {
324
- }
325
- ````
326
-