Skip to content

Commit e948bee

Browse files
committed
docs(check-param-names): update docs for disableMissingParamChecks
1 parent ba642e4 commit e948bee

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

docs/rules/check-param-names.md

+61-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [`checkDestructured`](#user-content-check-param-names-options-checkdestructured)
1313
* [`useDefaultObjectProperties`](#user-content-check-param-names-options-usedefaultobjectproperties)
1414
* [`disableExtraPropertyReporting`](#user-content-check-param-names-options-disableextrapropertyreporting)
15+
* [`disableMissingParamChecks`](#user-content-check-param-names-options-disablemissingparamchecks)
1516
* [Context and settings](#user-content-check-param-names-context-and-settings)
1617
* [Failing examples](#user-content-check-param-names-failing-examples)
1718
* [Passing examples](#user-content-check-param-names-passing-examples)
@@ -116,11 +117,11 @@ item at the same level is destructured as destructuring will prevent other
116117
access and this option is only intended to permit documenting extra properties
117118
that are available and actually used in the function.
118119

119-
<a name="user-content-check-param-names-options-disableMissingParamChecks"></a>
120-
<a name="check-param-names-options-disableMissingParamChecks"></a>
120+
<a name="user-content-check-param-names-options-disablemissingparamchecks"></a>
121+
<a name="check-param-names-options-disablemissingparamchecks"></a>
121122
### <code>disableMissingParamChecks</code>
122123

123-
Whether to check for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.
124+
Whether to avoid checks for missing `@param` definitions. Defaults to `false`. Change to `true` if you want to be able to omit properties.
124125

125126
<a name="user-content-check-param-names-context-and-settings"></a>
126127
<a name="check-param-names-context-and-settings"></a>
@@ -621,6 +622,41 @@ function quux (foo) {
621622
*/
622623
declare function foo(bar: number) {}
623624
// Message: Expected @param names to be "bar". Got "barr".
625+
626+
/**
627+
* @param foo
628+
* @param foo.bar
629+
*/
630+
function quux (bar, foo) {
631+
}
632+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":false}]
633+
// Message: Expected @param names to be "bar, foo". Got "foo".
634+
635+
/**
636+
* @param foo
637+
*/
638+
function quux (bar, baz) {
639+
}
640+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
641+
// Message: Expected @param names to be "bar, baz". Got "foo".
642+
643+
/**
644+
* @param bar
645+
* @param foo
646+
*/
647+
function quux (foo, bar) {
648+
}
649+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
650+
// Message: Expected @param names to be "foo, bar". Got "bar, foo".
651+
652+
/**
653+
* @param foo
654+
* @param bar
655+
*/
656+
function quux (foo) {
657+
}
658+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
659+
// Message: @param "bar" does not match an existing function parameter.
624660
````
625661

626662

@@ -1037,5 +1073,27 @@ function foo(this: T, bar: number): number {
10371073
console.log(this.name);
10381074
return bar;
10391075
}
1076+
1077+
/**
1078+
* Documentation
1079+
*/
1080+
function quux (foo, bar) {
1081+
}
1082+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
1083+
1084+
/**
1085+
* @param bar
1086+
* @param bar.baz
1087+
*/
1088+
function quux (foo, bar) {
1089+
}
1090+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
1091+
1092+
/**
1093+
* @param foo
1094+
*/
1095+
function quux (foo, bar) {
1096+
}
1097+
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
10401098
````
10411099

0 commit comments

Comments
 (0)