gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.1k stars 160 forks source link

Option to only enforce `jsdoc/require-param` if any parameters are documented, but allow no parameters to be documented #1317

Closed matthew-holder-revvity closed 1 month ago

matthew-holder-revvity commented 2 months ago

Motivation

Some functions are so simple, such as type-guard function in TypeScript, that they don't really need their parameters to be typed. For example:

/** Determines if the value is a number. */
export function isNumber(value: unknown): value is number { return typeof value === 'number' }

These functions would look cleaner with a single line comment. This would also not be limited to just type-guard functions, but many kinds of simple single argument functions.

Current behavior

Currently the rule requires all parameters to be documented.

Desired behavior

An option that would enable a sort of all-or-nothing mode; if any parameter is document, then they all must be. Otherwise, none need be.

Alternatives considered

While pattern exclusions may work fine for some project, likely not all.

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 50.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

matthew-holder-revvity commented 1 month ago

Nice, thanks.