@@ -14772,10 +14772,32 @@ class A {
14772
14772
14773
14773
Requires that each `@param` tag has a `description` value.
14774
14774
14775
+ Will exempt destructured roots and their children if
14776
+ `settings.exemptDestructuredRootsFromChecks` is set to `true` (e.g.,
14777
+ `@param {object} props` will be exempted from requiring a description given
14778
+ `function someFunc ({child1, child2})`).
14779
+
14775
14780
<a name="user-content-eslint-plugin-jsdoc-rules-require-param-description-options-29"></a>
14776
14781
<a name="eslint-plugin-jsdoc-rules-require-param-description-options-29"></a>
14777
14782
#### Options
14778
14783
14784
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-description-options-29-setdefaultdestructuredrootdescription"></a>
14785
+ <a name="eslint-plugin-jsdoc-rules-require-param-description-options-29-setdefaultdestructuredrootdescription"></a>
14786
+ ##### <code>setDefaultDestructuredRootDescription</code>
14787
+
14788
+ Whether to set a default destructured root description. For example, you may
14789
+ wish to avoid manually having to set the description for a `@param`
14790
+ corresponding to a destructured root object as it should always be the same
14791
+ type of object. Uses `defaultDestructuredRootDescription` for the description
14792
+ string. Defaults to `false`.
14793
+
14794
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-description-options-29-defaultdestructuredrootdescription"></a>
14795
+ <a name="eslint-plugin-jsdoc-rules-require-param-description-options-29-defaultdestructuredrootdescription"></a>
14796
+ ##### <code>defaultDestructuredRootDescription</code>
14797
+
14798
+ The description string to set by default for destructured roots. Defaults to
14799
+ "The root object".
14800
+
14779
14801
<a name="user-content-eslint-plugin-jsdoc-rules-require-param-description-options-29-contexts-8"></a>
14780
14802
<a name="eslint-plugin-jsdoc-rules-require-param-description-options-29-contexts-8"></a>
14781
14803
##### <code>contexts</code>
@@ -14797,7 +14819,8 @@ section of our README for more on the expected format.
14797
14819
|Tags|`param`|
14798
14820
|Aliases|`arg`, `argument`|
14799
14821
|Recommended|true|
14800
- |Options|`contexts`|
14822
+ |Options|`setDefaultDestructuredRootDescription`, `defaultDestructuredRootDescription`, `contexts`|
14823
+ |Settings|`exemptDestructuredRootsFromChecks`|
14801
14824
14802
14825
The following patterns are considered problems:
14803
14826
@@ -14859,6 +14882,39 @@ function quux (foo) {
14859
14882
}
14860
14883
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
14861
14884
// Message: Missing JSDoc @param "foo" description.
14885
+
14886
+ /**
14887
+ * @param {number} foo Foo description
14888
+ * @param {object} root
14889
+ * @param {boolean} baz Baz description
14890
+ */
14891
+ function quux (foo, {bar}, baz) {
14892
+
14893
+ }
14894
+ // "jsdoc/require-param-description": ["error"|"warn", {"setDefaultDestructuredRootDescription":true}]
14895
+ // Message: Missing root description for @param.
14896
+
14897
+ /**
14898
+ * @param {number} foo Foo description
14899
+ * @param {object} root
14900
+ * @param {boolean} baz Baz description
14901
+ */
14902
+ function quux (foo, {bar}, baz) {
14903
+
14904
+ }
14905
+ // "jsdoc/require-param-description": ["error"|"warn", {"defaultDestructuredRootDescription":"Root description","setDefaultDestructuredRootDescription":true}]
14906
+ // Message: Missing root description for @param.
14907
+
14908
+ /**
14909
+ * @param {number} foo Foo description
14910
+ * @param {object} root
14911
+ * @param {boolean} baz Baz description
14912
+ */
14913
+ function quux (foo, {bar}, baz) {
14914
+
14915
+ }
14916
+ // "jsdoc/require-param-description": ["error"|"warn", {"setDefaultDestructuredRootDescription":false}]
14917
+ // Message: Missing JSDoc @param "root" description.
14862
14918
````
14863
14919
14864
14920
The following patterns are not considered problems:
@@ -14903,6 +14959,26 @@ function quux (props) {
14903
14959
14904
14960
}
14905
14961
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
14962
+
14963
+ /**
14964
+ * @param {number} foo Foo description
14965
+ * @param {object} root
14966
+ * @param {boolean} baz Baz description
14967
+ */
14968
+ function quux (foo, {bar}, baz) {
14969
+
14970
+ }
14971
+ // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
14972
+
14973
+ /**
14974
+ * @param {number} foo Foo description
14975
+ * @param {object} root
14976
+ * @param {object} root.bar
14977
+ */
14978
+ function quux (foo, {bar: {baz}}) {
14979
+
14980
+ }
14981
+ // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
14906
14982
````
14907
14983
14908
14984
@@ -15055,10 +15131,31 @@ function example(cb) {
15055
15131
15056
15132
Requires that each `@param` tag has a `type` value.
15057
15133
15134
+ Will exempt destructured roots and their children if
15135
+ `settings.exemptDestructuredRootsFromChecks` is set to `true` (e.g.,
15136
+ `@param props` will be exempted from requiring a type given
15137
+ `function someFunc ({child1, child2})`).
15138
+
15058
15139
<a name="user-content-eslint-plugin-jsdoc-rules-require-param-type-options-31"></a>
15059
15140
<a name="eslint-plugin-jsdoc-rules-require-param-type-options-31"></a>
15060
15141
#### Options
15061
15142
15143
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-type-options-31-setdefaultdestructuredroottype"></a>
15144
+ <a name="eslint-plugin-jsdoc-rules-require-param-type-options-31-setdefaultdestructuredroottype"></a>
15145
+ ##### <code>setDefaultDestructuredRootType</code>
15146
+
15147
+ Whether to set a default destructured root type. For example, you may wish
15148
+ to avoid manually having to set the type for a `@param`
15149
+ corresponding to a destructured root object as it is always going to be an
15150
+ object. Uses `defaultDestructuredRootType` for the type string. Defaults to
15151
+ `false`.
15152
+
15153
+ <a name="user-content-eslint-plugin-jsdoc-rules-require-param-type-options-31-defaultdestructuredroottype"></a>
15154
+ <a name="eslint-plugin-jsdoc-rules-require-param-type-options-31-defaultdestructuredroottype"></a>
15155
+ ##### <code>defaultDestructuredRootType</code>
15156
+
15157
+ The type string to set by default for destructured roots. Defaults to "object".
15158
+
15062
15159
<a name="user-content-eslint-plugin-jsdoc-rules-require-param-type-options-31-contexts-10"></a>
15063
15160
<a name="eslint-plugin-jsdoc-rules-require-param-type-options-31-contexts-10"></a>
15064
15161
##### <code>contexts</code>
@@ -15080,7 +15177,8 @@ section of our README for more on the expected format.
15080
15177
|Tags|`param`|
15081
15178
|Aliases|`arg`, `argument`|
15082
15179
|Recommended|true|
15083
- |Options|`contexts`|
15180
+ |Options|`setDefaultDestructuredRootType`, `defaultDestructuredRootType`, `contexts`|
15181
+ |Settings|`exemptDestructuredRootsFromChecks`|
15084
15182
15085
15183
The following patterns are considered problems:
15086
15184
@@ -15140,6 +15238,39 @@ function quux (foo) {
15140
15238
}
15141
15239
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
15142
15240
// Message: Unexpected tag `@param`
15241
+
15242
+ /**
15243
+ * @param {number} foo
15244
+ * @param root
15245
+ * @param {boolean} baz
15246
+ */
15247
+ function quux (foo, {bar}, baz) {
15248
+
15249
+ }
15250
+ // "jsdoc/require-param-type": ["error"|"warn", {"setDefaultDestructuredRootType":true}]
15251
+ // Message: Missing root type for @param.
15252
+
15253
+ /**
15254
+ * @param {number} foo
15255
+ * @param root
15256
+ * @param {boolean} baz
15257
+ */
15258
+ function quux (foo, {bar}, baz) {
15259
+
15260
+ }
15261
+ // "jsdoc/require-param-type": ["error"|"warn", {"defaultDestructuredRootType":"Object","setDefaultDestructuredRootType":true}]
15262
+ // Message: Missing root type for @param.
15263
+
15264
+ /**
15265
+ * @param {number} foo
15266
+ * @param root
15267
+ * @param {boolean} baz
15268
+ */
15269
+ function quux (foo, {bar}, baz) {
15270
+
15271
+ }
15272
+ // "jsdoc/require-param-type": ["error"|"warn", {"setDefaultDestructuredRootType":false}]
15273
+ // Message: Missing JSDoc @param "root" type.
15143
15274
````
15144
15275
15145
15276
The following patterns are not considered problems:
@@ -15176,6 +15307,26 @@ function quux (foo) {
15176
15307
* @callback
15177
15308
* @param foo
15178
15309
*/
15310
+
15311
+ /**
15312
+ * @param {number} foo
15313
+ * @param root
15314
+ * @param {boolean} baz
15315
+ */
15316
+ function quux (foo, {bar}, baz) {
15317
+
15318
+ }
15319
+ // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
15320
+
15321
+ /**
15322
+ * @param {number} foo
15323
+ * @param root
15324
+ * @param root.bar
15325
+ */
15326
+ function quux (foo, {bar: {baz}}) {
15327
+
15328
+ }
15329
+ // Settings: {"jsdoc":{"exemptDestructuredRootsFromChecks":true}}
15179
15330
````
15180
15331
15181
15332
0 commit comments