gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.07k stars 155 forks source link

`jsdoc/check-param-names` reports `Expected @param names to be "[object Object]"` when using destructured spread arguments #1225

Closed Cipscis closed 4 days ago

Cipscis commented 2 months ago

Expected behavior

In my TypeScript projects, I occasionally use discriminated unions of tuples to define function parameters. This lets me get autocomplete for arguments based on the value of the first argument, without having to write an overload definition for each option.

If I give the wrong parameter names, I would expect the jsdoc/check-param-names to tell me. I would also expect it not to complain if I give the correct parameter names.

Actual behavior

Even if I use the correct parameter names, I get an eslint error saying:

Expected @param names to be "[object Object]".

ESLint Config

'jsdoc/check-param-names': 'warn',

ESLint sample

type FnArgs = [type: 'a', arg: number] | [type: 'b', arg: string];

/**
 * @param type Type
 * @param arg Arg
 */
export function fn(...[type, arg]: FnArgs): void {
    // ...
}

Environment

github-actions[bot] commented 4 days ago

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

The release is available on:

Your semantic-release bot :package::rocket: