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
Don't require Docs for short methods in require-jsdoc
#870
Comments
…hort functions/contexts; fixes gajus#870
I submitted #871 to handle this. I allowed for both a global |
@brettz9 you rock! thanks for implementing this so fast. |
…hort functions/contexts; fixes gajus#870
🎉 This issue has been resolved in version 39.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) | devDependencies | minor | [`39.1.0` -> `39.2.1`](https://renovatebot.com/diffs/npm/eslint-plugin-jsdoc/39.1.0/39.2.1) | --- ### Release Notes <details> <summary>gajus/eslint-plugin-jsdoc</summary> ### [`v39.2.1`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v39.2.1) [Compare Source](gajus/eslint-plugin-jsdoc@v39.2.0...v39.2.1) ##### Bug Fixes - regression with checking TS MethodDefinition params ([041de5f](gajus/eslint-plugin-jsdoc@041de5f)) ### [`v39.2.0`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v39.2.0) [Compare Source](gajus/eslint-plugin-jsdoc@v39.1.1...v39.2.0) ##### Features - **`require-jsdoc`:** add `minLineCount` option to avoid reporting short functions/contexts; fixes [#​870](gajus/eslint-plugin-jsdoc#870) ([199aa4a](gajus/eslint-plugin-jsdoc@199aa4a)) - support inline `minLineCount` ([288363e](gajus/eslint-plugin-jsdoc@288363e)) ### [`v39.1.1`](https://github.com/gajus/eslint-plugin-jsdoc/releases/v39.1.1) [Compare Source](gajus/eslint-plugin-jsdoc@v39.1.0...v39.1.1) ##### Bug Fixes - **`require-jsdoc`:** detect ClassDeclaration as referenced public export and ClassExpression methods; fixes [#​648](gajus/eslint-plugin-jsdoc#648) ([520c7be](gajus/eslint-plugin-jsdoc@520c7be)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1300 Reviewed-by: crapStone <crapstone@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Motivation
Using the
require-jsdoc
rule, we currently have no way of excluding "trivial" methods, so we have to write many comments that just paraphrase the method name. In Java-Checkstyle, we have the option of excluding methods with less thann
rows, wheren
can be specified with the parameterminLineCount
(https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.html).We already have similar options for get/set accessors and we can exclude specific things like constructors using the
context
property, but especially for projects using method getters/setters instead of JavaScript accessors, I think such a parameter would improve the usability of the rule. My projects are not using accessors because I believe it is an antipattern (https://www.reddit.com/r/typescript/comments/87t1h7/are_getters_and_setters_an_antipattern/) but I would really like to enforce comments for more complex methods.Current behavior
Currently, we would have to write parapharasing comments to our getters/setters in a project:
Desired behavior
I would like to set a property like
"minLineCount": 2
in my.eslintrc.json
to suppress warings for one-liner methods. This would result in the code above not needing comments, and we would not have to write the same thing in three rows:Alternatives considered
Currently we have the option of disabling the rule for get and set accessors, so we could consider implementing a "detection" mechanism for plain getter and setter methods (e.g. should be simple using a regular expression). However, since people are already using
minLineCount
in a Java/CheckStyle context, I think that one would be the easier-to-implement and more convenient option.The text was updated successfully, but these errors were encountered: