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

[require-description] checkConstructors not working when contexts sets to [MethodDefinition] #534

Closed
OpportunityLiu opened this issue May 12, 2020 · 3 comments

Comments

@OpportunityLiu
Copy link

For example:

/**
 *
 */
class Foo {
    /**
     *
     */
    constructor() {}

    /**
     *
     */
    bar() {}
}

I need to add [ClassDeclaration] to context for the doc of class, but with contexts: [ClassDeclaration], both constructor & bar have no Missing JSDoc block description. warning. When I add [MethodDefinition] to contexts, or set contexts: [any], both constructor & bar have Missing JSDoc block description. warning, even if checkConstructors: false is set.

@brettz9
Copy link
Collaborator

brettz9 commented May 12, 2020

The checkConstructors option does not exist on require-jsdoc.

You can get the behavior, however, as follows (and I've added this as a test case / docs, for future reference) (the contexts are esquery expressions, and you can consult the esquery docs and the likes of https://astexplorer.net/ to discover AST details for building expressions for your desired syntax):

        {
          contexts: [
            'MethodDefinition[key.name!="constructor"]',
          ],
          require: {
            ClassDeclaration: true,
          },
        }

Closing as that should address, but feel free to comment further.

@brettz9 brettz9 closed this as completed May 12, 2020
@OpportunityLiu
Copy link
Author

I means require-description, not require-jsdoc

https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-description

The checkConstructors option exists, otherwise eslint will failed to parse .eslintrc before it can actually analysis files.

@brettz9 brettz9 reopened this May 12, 2020
@brettz9 brettz9 added bug and removed question labels May 12, 2020
@gajus
Copy link
Owner

gajus commented May 12, 2020

🎉 This issue has been resolved in version 25.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants