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,181 @@
1
+ <a name="user-content-require-returns-description"></a>
2
+ <a name="require-returns-description"></a>
3
+ # <code>require-returns-description</code>
4
+
5
+ * [Options](#user-content-require-returns-description-options)
6
+ * [`contexts`](#user-content-require-returns-description-options-contexts)
7
+ * [Context and settings](#user-content-require-returns-description-context-and-settings)
8
+ * [Failing examples](#user-content-require-returns-description-failing-examples)
9
+ * [Passing examples](#user-content-require-returns-description-passing-examples)
10
+
11
+
12
+ Requires that the `@returns` tag has a `description` value. The error
13
+ will not be reported if the return value is `void` or `undefined`
14
+ or if it is `Promise<void>` or `Promise<undefined>`.
15
+
16
+ <a name="user-content-require-returns-description-options"></a>
17
+ <a name="require-returns-description-options"></a>
18
+ ## Options
19
+
20
+ <a name="user-content-require-returns-description-options-contexts"></a>
21
+ <a name="require-returns-description-options-contexts"></a>
22
+ ### <code>contexts</code>
23
+
24
+ Set this to an array of strings representing the AST context (or an object with
25
+ `context` and `comment` properties) where you wish the rule to be applied.
26
+ Overrides the default contexts (see below). Set to `"any"` if you want
27
+ the rule to apply to any jsdoc block throughout your files (as is necessary
28
+ for finding function blocks not attached to a function declaration or
29
+ expression, i.e., `@callback` or `@function` (or its aliases `@func` or
30
+ `@method`) (including those associated with an `@interface`).
31
+
32
+ See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
33
+ section of our README for more on the expected format.
34
+
35
+ <a name="user-content-require-returns-description-context-and-settings"></a>
36
+ <a name="require-returns-description-context-and-settings"></a>
37
+ ## Context and settings
38
+
39
+ |||
40
+ |---|---|
41
+ |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
42
+ |Tags|`returns`|
43
+ |Aliases|`return`|
44
+ |Recommended|true|
45
+ |Options|`contexts`|
46
+
47
+ <a name="user-content-require-returns-description-failing-examples"></a>
48
+ <a name="require-returns-description-failing-examples"></a>
49
+ ## Failing examples
50
+
51
+ The following patterns are considered problems:
52
+
53
+ ````js
54
+ /**
55
+ * @returns
56
+ */
57
+ function quux (foo) {
58
+
59
+ }
60
+ // Message: Missing JSDoc @returns description.
61
+
62
+ /**
63
+ * @returns {string}
64
+ */
65
+ function quux (foo) {
66
+
67
+ }
68
+ // Message: Missing JSDoc @returns description.
69
+
70
+ /**
71
+ * @returns {string}
72
+ */
73
+ function quux (foo) {
74
+
75
+ }
76
+ // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
77
+ // Message: Missing JSDoc @returns description.
78
+
79
+ /**
80
+ * @function
81
+ * @returns {string}
82
+ */
83
+ // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
84
+ // Message: Missing JSDoc @returns description.
85
+
86
+ /**
87
+ * @callback
88
+ * @returns {string}
89
+ */
90
+ // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
91
+ // Message: Missing JSDoc @returns description.
92
+
93
+ /**
94
+ * @return
95
+ */
96
+ function quux (foo) {
97
+
98
+ }
99
+ // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
100
+ // Message: Missing JSDoc @return description.
101
+
102
+ /**
103
+ * @returns
104
+ */
105
+ function quux () {
106
+
107
+ }
108
+ // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
109
+ // Message: Unexpected tag `@returns`
110
+ ````
111
+
112
+
113
+
114
+ <a name="user-content-require-returns-description-passing-examples"></a>
115
+ <a name="require-returns-description-passing-examples"></a>
116
+ ## Passing examples
117
+
118
+ The following patterns are not considered problems:
119
+
120
+ ````js
121
+ /**
122
+ *
123
+ */
124
+ function quux () {
125
+
126
+ }
127
+
128
+ /**
129
+ * @returns Foo.
130
+ */
131
+ function quux () {
132
+
133
+ }
134
+
135
+ /**
136
+ * @returns Foo.
137
+ */
138
+ function quux () {
139
+
140
+ }
141
+ // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
142
+
143
+ /**
144
+ * @returns {undefined}
145
+ */
146
+ function quux () {
147
+
148
+ }
149
+
150
+ /**
151
+ * @returns {void}
152
+ */
153
+ function quux () {
154
+
155
+ }
156
+
157
+ /**
158
+ * @returns {Promise<void>}
159
+ */
160
+ function quux () {
161
+
162
+ }
163
+
164
+ /**
165
+ * @returns {Promise<undefined>}
166
+ */
167
+ function quux () {
168
+
169
+ }
170
+
171
+ /**
172
+ * @function
173
+ * @returns
174
+ */
175
+
176
+ /**
177
+ * @callback
178
+ * @returns
179
+ */
180
+ ````
181
+
@@ -0,0 +1,144 @@
1
+ <a name="user-content-require-returns-type"></a>
2
+ <a name="require-returns-type"></a>
3
+ # <code>require-returns-type</code>
4
+
5
+ * [Options](#user-content-require-returns-type-options)
6
+ * [`contexts`](#user-content-require-returns-type-options-contexts)
7
+ * [Context and settings](#user-content-require-returns-type-context-and-settings)
8
+ * [Failing examples](#user-content-require-returns-type-failing-examples)
9
+ * [Passing examples](#user-content-require-returns-type-passing-examples)
10
+
11
+
12
+ Requires that `@returns` tag has a `type` value (in curly brackets).
13
+
14
+ <a name="user-content-require-returns-type-options"></a>
15
+ <a name="require-returns-type-options"></a>
16
+ ## Options
17
+
18
+ <a name="user-content-require-returns-type-options-contexts"></a>
19
+ <a name="require-returns-type-options-contexts"></a>
20
+ ### <code>contexts</code>
21
+
22
+ Set this to an array of strings representing the AST context (or an object with
23
+ `context` and `comment` properties) where you wish the rule to be applied.
24
+ Overrides the default contexts (see below). Set to `"any"` if you want
25
+ the rule to apply to any jsdoc block throughout your files (as is necessary
26
+ for finding function blocks not attached to a function declaration or
27
+ expression, i.e., `@callback` or `@function` (or its aliases `@func` or
28
+ `@method`) (including those associated with an `@interface`).
29
+
30
+ See the ["AST and Selectors"](#user-content-eslint-plugin-jsdoc-advanced-ast-and-selectors)
31
+ section of our README for more on the expected format.
32
+
33
+ <a name="user-content-require-returns-type-context-and-settings"></a>
34
+ <a name="require-returns-type-context-and-settings"></a>
35
+ ## Context and settings
36
+
37
+ |||
38
+ |---|---|
39
+ |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
40
+ |Tags|`returns`|
41
+ |Aliases|`return`|
42
+ |Recommended|true|
43
+ |Options|`contexts`|
44
+
45
+ <a name="user-content-require-returns-type-failing-examples"></a>
46
+ <a name="require-returns-type-failing-examples"></a>
47
+ ## Failing examples
48
+
49
+ The following patterns are considered problems:
50
+
51
+ ````js
52
+ /**
53
+ * @returns
54
+ */
55
+ function quux () {
56
+
57
+ }
58
+ // Message: Missing JSDoc @returns type.
59
+
60
+ /**
61
+ * @returns Foo.
62
+ */
63
+ function quux () {
64
+
65
+ }
66
+ // Message: Missing JSDoc @returns type.
67
+
68
+ /**
69
+ * @returns Foo.
70
+ */
71
+ function quux () {
72
+
73
+ }
74
+ // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
75
+ // Message: Missing JSDoc @returns type.
76
+
77
+ /**
78
+ * @function
79
+ * @returns Foo.
80
+ */
81
+ // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
82
+ // Message: Missing JSDoc @returns type.
83
+
84
+ /**
85
+ * @callback
86
+ * @returns Foo.
87
+ */
88
+ // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
89
+ // Message: Missing JSDoc @returns type.
90
+
91
+ /**
92
+ * @return Foo.
93
+ */
94
+ function quux () {
95
+
96
+ }
97
+ // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
98
+ // Message: Missing JSDoc @return type.
99
+
100
+ /**
101
+ * @returns
102
+ */
103
+ function quux () {
104
+
105
+ }
106
+ // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
107
+ // Message: Unexpected tag `@returns`
108
+ ````
109
+
110
+
111
+
112
+ <a name="user-content-require-returns-type-passing-examples"></a>
113
+ <a name="require-returns-type-passing-examples"></a>
114
+ ## Passing examples
115
+
116
+ The following patterns are not considered problems:
117
+
118
+ ````js
119
+ /**
120
+ * @returns {number}
121
+ */
122
+ function quux () {
123
+
124
+ }
125
+
126
+ /**
127
+ * @returns {number}
128
+ */
129
+ function quux () {
130
+
131
+ }
132
+ // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
133
+
134
+ /**
135
+ * @function
136
+ * @returns Foo.
137
+ */
138
+
139
+ /**
140
+ * @callback
141
+ * @returns Foo.
142
+ */
143
+ ````
144
+
@@ -0,0 +1,326 @@
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
+