gajus / eslint-plugin-jsdoc

JSDoc specific linting rules for ESLint.
Other
1.09k stars 157 forks source link

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

Closed reececomo closed 1 year ago

reececomo commented 1 year ago

Split from https://github.com/gajus/eslint-plugin-jsdoc/issues/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

github-actions[bot] commented 1 year ago

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

The release is available on:

Your semantic-release bot :package::rocket:

reececomo commented 1 year ago

Thank you @brettz9!