Skip to content

Commit

Permalink
docs(check-param-names): update docs for disableMissingParamChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Feb 22, 2024
1 parent ba642e4 commit e948bee
Showing 1 changed file with 61 additions and 3 deletions.
64 changes: 61 additions & 3 deletions docs/rules/check-param-names.md
Expand Up @@ -12,6 +12,7 @@
* [`checkDestructured`](#user-content-check-param-names-options-checkdestructured)
* [`useDefaultObjectProperties`](#user-content-check-param-names-options-usedefaultobjectproperties)
* [`disableExtraPropertyReporting`](#user-content-check-param-names-options-disableextrapropertyreporting)
* [`disableMissingParamChecks`](#user-content-check-param-names-options-disablemissingparamchecks)
* [Context and settings](#user-content-check-param-names-context-and-settings)
* [Failing examples](#user-content-check-param-names-failing-examples)
* [Passing examples](#user-content-check-param-names-passing-examples)
Expand Down Expand Up @@ -116,11 +117,11 @@ item at the same level is destructured as destructuring will prevent other
access and this option is only intended to permit documenting extra properties
that are available and actually used in the function.

<a name="user-content-check-param-names-options-disableMissingParamChecks"></a>
<a name="check-param-names-options-disableMissingParamChecks"></a>
<a name="user-content-check-param-names-options-disablemissingparamchecks"></a>
<a name="check-param-names-options-disablemissingparamchecks"></a>
### <code>disableMissingParamChecks</code>

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

<a name="user-content-check-param-names-context-and-settings"></a>
<a name="check-param-names-context-and-settings"></a>
Expand Down Expand Up @@ -621,6 +622,41 @@ function quux (foo) {
*/
declare function foo(bar: number) {}
// Message: Expected @param names to be "bar". Got "barr".

/**
* @param foo
* @param foo.bar
*/
function quux (bar, foo) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":false}]
// Message: Expected @param names to be "bar, foo". Got "foo".

/**
* @param foo
*/
function quux (bar, baz) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
// Message: Expected @param names to be "bar, baz". Got "foo".

/**
* @param bar
* @param foo
*/
function quux (foo, bar) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
// Message: Expected @param names to be "foo, bar". Got "bar, foo".

/**
* @param foo
* @param bar
*/
function quux (foo) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
// Message: @param "bar" does not match an existing function parameter.
````


Expand Down Expand Up @@ -1037,5 +1073,27 @@ function foo(this: T, bar: number): number {
console.log(this.name);
return bar;
}

/**
* Documentation
*/
function quux (foo, bar) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]

/**
* @param bar
* @param bar.baz
*/
function quux (foo, bar) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]

/**
* @param foo
*/
function quux (foo, bar) {
}
// "jsdoc/check-param-names": ["error"|"warn", {"disableMissingParamChecks":true}]
````

0 comments on commit e948bee

Please sign in to comment.