Skip to content

require-param rule destructuring false errors #569

@jaydenseric

Description

@jaydenseric

The require-param rule option checkTypesPattern currently doesn't work deeply for destructured parameters.

Expected behavior

If you use object for an @param root type but then a named type (e.g. FooBar) for one of it's destructured properties, there should be no jsdoc/require-param lint errors.

Actual behavior

There are unexpected lint errors.

ESLint Config

{
  "rules": {
    "jsdoc/require-param": "error"
  }
}

ESLint sample

This has the unexpected lint error Missing JSDoc @param "options.a.b" declaration. eslint(jsdoc/require-param):

/**
 * Description.
 * @param {object} options Options.
 * @param {FooBar} options.a A description.
 */
function foo({ a: { b } }) {}

This does not:

/**
 * Description.
 * @param {Foo} options Options.
 * @param {FooBar} options.a A description.
 */
function foo({ a: { b } }) {}

Environment

  • Node version: v14.4.0
  • ESLint version v7.2.0
  • eslint-plugin-jsdoc version: v27.0.4

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions