Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsdoc/require-jsdoc - publicOnly not working with contexts[].PropertyDefinition #1122

Closed
reececomo opened this issue Jun 28, 2023 · 7 comments · Fixed by #1123
Closed

jsdoc/require-jsdoc - publicOnly not working with contexts[].PropertyDefinition #1122

reececomo opened this issue Jun 28, 2023 · 7 comments · Fixed by #1123

Comments

@reececomo
Copy link

reececomo commented Jun 28, 2023

tl;dr: Trying to configure a rule so that we document all public members/properties/accessors.

Expected behavior

When using jsdoc/require-jsdoc I would expect publicOnly and contexts[].PropertyDefinition together to mean that public properties required docs.

Actual behavior

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

We tried ClassProperty too, but that appears to cause a lot of false negatives.

For context there are also these related tickets, but we did not find the answer:

ESLint Config

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

ESLint sample

export class MyClass {

  public myPublicProperty: number = 1;
       /* ^ Missing JSDoc comment. eslint(jsdoc/require-jsdoc) - expected ✅ */

  private myPrivateProp: number = -1;
       /* ^ 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.0
@github-actions
Copy link

🎉 This issue has been resolved in version 46.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@reececomo
Copy link
Author

@brettz9 same thing with require.MethodDefinition and the other requires 😬

Should I open a separate issue?

@reececomo
Copy link
Author

Also, thanks for jumping on that so quickly!

@brettz9
Copy link
Collaborator

brettz9 commented Jun 28, 2023

I need a code sample regardless of where you post it.

@reececomo
Copy link
Author

It's the exact same issue but for class methods instead of properties

@brettz9
Copy link
Collaborator

brettz9 commented Jun 28, 2023

So your context is exactly MethodDefinition?

@reececomo
Copy link
Author

Moved to #1124 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants