Skip to content

jsdoc/require-jsdoc - publicOnly not working with require.MethodDefinition #1124

@reececomo

Description

@reececomo

Split from #1122.

Expected behavior

When using jsdoc/require-jsdoc I would expect publicOnly and require.MethodDefinition together to mean that public methods required docs.

Actual behavior

Private/protected methods are also failing the lint check too (unexpectedly).

I imagine this issue unexpectedly would apply to other require. properties or context. options too.

ESLint Config

    "jsdoc/require-jsdoc": [
      'error',
      {
        checkConstructors: false,
        publicOnly: true,
        require: {
          'MethodDefinition': true
        }
      }
    ],

ESLint sample

export class MyClass {

  public myPublicMethod(): void { }
      /* ^ Missing JSDoc comment. eslint(jsdoc/require-jsdoc) - expected ✅ */

  private myPrivateMethod(): void { }
       /* ^ Missing JSDoc comment. eslint(jsdoc/require-jsdoc) - unexpected ❌ */

  // ...
}

Environment

  • Node version: ^16.16.0
  • ESLint version: 8.43.0
  • eslint-plugin-jsdoc version: 46.4.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions