@@ -2266,10 +2266,18 @@ their presence within the function signature. Other inconsistencies between
22662266
22672267Whether to check destructured properties. Defaults to ` true ` .
22682268
2269+ <a name =" eslint-plugin-jsdoc-rules-check-param-names-options-4-usedefaultobjectproperties " ></a >
2270+ ##### <code >useDefaultObjectProperties</code >
2271+
2272+ Set to ` true ` if you wish to avoid reporting of child property documentation
2273+ where instead of destructuring, a whole plain object is supplied as default
2274+ value but you wish its keys to be considered as signalling that the properties
2275+ are present and can therefore be documented. Defaults to ` false ` .
2276+
22692277|||
22702278| ---| ---|
22712279| Context| ` ArrowFunctionExpression ` , ` FunctionDeclaration ` , ` FunctionExpression ` |
2272- | Options| ` allowExtraTrailingParamDocs ` , ` checkDestructured ` , ` checkRestProperty ` , ` checkTypesPattern ` |
2280+ | Options| ` allowExtraTrailingParamDocs ` , ` checkDestructured ` , ` checkRestProperty ` , ` checkTypesPattern ` , ` useDefaultObjectProperties ` |
22732281| Tags| ` param ` |
22742282| Aliases| ` arg ` , ` argument ` |
22752283| Recommended| true|
@@ -2664,6 +2672,19 @@ function quux ({ foo: { bar } }) {}
26642672 */
26652673function foo ({ foo: { bar: { baz } }}) {}
26662674// Message: Missing @param "options.foo.bar.baz"
2675+
2676+ /**
2677+ * Returns a number.
2678+ * @param {Object} props Props.
2679+ * @param {Object} props.prop Prop.
2680+ * @param {string} props.prop.a String.
2681+ * @param {string} props.prop.b String.
2682+ * @return {number} A number.
2683+ */
2684+ export function testFn1 ({ prop = { a: 1 , b: 2 } }) {
2685+ }
2686+ // Options: [{"useDefaultObjectProperties":false}]
2687+ // Message: @param "props.prop.a" does not exist on props
26672688````
26682689
26692690The following patterns are not considered problems:
@@ -2995,6 +3016,18 @@ function Item({
29953016 defaulting: [quux, xyz] = []
29963017}) {
29973018}
3019+
3020+ /**
3021+ * Returns a number.
3022+ * @param {Object} props Props.
3023+ * @param {Object} props.prop Prop.
3024+ * @param {string} props.prop.a String.
3025+ * @param {string} props.prop.b String.
3026+ * @return {number} A number.
3027+ */
3028+ export function testFn1 ({ prop = { a: 1 , b: 2 } }) {
3029+ }
3030+ // Options: [{"useDefaultObjectProperties":true}]
29983031````
29993032
30003033
@@ -11930,14 +11963,20 @@ implied to be `false` (i.e., the inside of the roots will not be checked
1193011963either, e.g., it will also not complain if ` a ` or ` b ` do not have their own
1193111964documentation). Defaults to ` true ` .
1193211965
11933- | | |
11934- | -------- | ------------------------------------------------------------------------------------------------------------- |
11966+ <a name =" eslint-plugin-jsdoc-rules-require-param-options-26-usedefaultobjectproperties-1 " ></a >
11967+ ##### <code >useDefaultObjectProperties</code >
11968+
11969+ Set to ` true ` if you wish to expect documentation of properties on objects
11970+ supplied as default values. Defaults to ` false ` .
11971+
11972+ | | |
11973+ | -------- | ----------------------------------------------------------------------------- |
1193511974| Context | ` ArrowFunctionExpression ` , ` FunctionDeclaration ` , ` FunctionExpression ` ; others when ` contexts ` option enabled |
11936- | Tags | ` param ` |
11937- | Aliases | ` arg ` , ` argument ` |
11938- | Recommended| true|
11939- | Options | ` autoIncrementBase ` , ` checkDestructured ` , ` checkDestructuredRoots ` , ` contexts ` , ` enableFixer ` , ` enableRootFixer ` , ` enableRestElementFixer ` , ` checkRestProperty ` , ` exemptedBy ` , ` checkConstructors ` , ` checkGetters ` , ` checkSetters ` , ` checkTypesPattern ` , ` unnamedRootBase ` |
11940- | Settings | ` overrideReplacesDocs ` , ` augmentsExtendsReplacesDocs ` , ` implementsReplacesDocs ` |
11975+ | Tags | ` param ` |
11976+ | Aliases | ` arg ` , ` argument ` |
11977+ | Recommended | true|
11978+ | Options | ` autoIncrementBase ` , ` checkDestructured ` , ` checkDestructuredRoots ` , ` contexts ` , ` enableFixer ` , ` enableRootFixer ` , ` enableRestElementFixer ` , ` checkRestProperty ` , ` exemptedBy ` , ` checkConstructors ` , ` checkGetters ` , ` checkSetters ` , ` checkTypesPattern ` , ` unnamedRootBase ` , ` useDefaultObjectProperties ` |
11979+ | Settings | ` overrideReplacesDocs ` , ` augmentsExtendsReplacesDocs ` , ` implementsReplacesDocs ` |
1194111980
1194211981The following patterns are considered problems:
1194311982
@@ -12582,6 +12621,17 @@ function quux ({ foo: { bar } }) {}
1258212621 */
1258312622function foo ({ foo: { bar: { baz } }}) {}
1258412623// Message: Missing JSDoc @param "options.foo.bar.baz" declaration.
12624+
12625+ /**
12626+ * Returns a number.
12627+ * @param {Object} props Props.
12628+ * @param {Object} props.prop Prop.
12629+ * @return {number} A number.
12630+ */
12631+ export function testFn1 ({ prop = { a: 1 , b: 2 } }) {
12632+ }
12633+ // Options: [{"useDefaultObjectProperties":true}]
12634+ // Message: Missing JSDoc @param "props.prop.a" declaration.
1258512635````
1258612636
1258712637The following patterns are not considered problems:
@@ -13195,6 +13245,16 @@ function Item({
1319513245 defaulting: [quux, xyz] = []
1319613246}) {
1319713247}
13248+
13249+ /**
13250+ * Returns a number.
13251+ * @param {Object} props Props.
13252+ * @param {Object} props.prop Prop.
13253+ * @return {number} A number.
13254+ */
13255+ export function testFn1 ({ prop = { a: 1 , b: 2 } }) {
13256+ }
13257+ // Options: [{"useDefaultObjectProperties":false}]
1319813258````
1319913259
1320013260
0 commit comments