-
-
Notifications
You must be signed in to change notification settings - Fork 159
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-returns
only on exported functions
#1137
Comments
This request applies to |
I've submitted #1156 for this. I'm not convinced we really need a |
Thanks! I'm sure we can live with adding types for |
🎉 This issue has been resolved in version 46.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Trying this out to see whether it seems to be a good idea or not. Related option: https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#options Related PR: gajus/eslint-plugin-jsdoc#1156 Related issue: gajus/eslint-plugin-jsdoc#1137
Trying this out to see whether it seems to be a good idea or not. Related option: https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-returns.md#options Related PR: gajus/eslint-plugin-jsdoc#1156 Related issue: gajus/eslint-plugin-jsdoc#1137
Motivation
We primarily use jsdoc comments to document our types for on-hover information in VSCode. Return types can often be inferred by typescript from the function body (even for javascript code), making
@returns
annotations redundant (aside from descriptions, which I also consider optional).Exported functions are an exception: I believe the API surface should be fully documented, and inference across module boundaries is potentially slower as well.
Current behavior
I don't think there is currently a way to automatically require
@returns
annotations only on exported functions.Desired behavior
I would like to see an option, e.g.
onlyExported
, that makes the rule only check exported symbols. I think this option should take precedence overforceRequireReturn
orforceReturnsWithAsync
.Alternatives considered
I guess we could use
@internal
to avoid requiring@returns
via theexemptedBy
option, but we don't use that currently. I'd like to encourage use of jsdoc comments in our codebase with minimal barrier to entry.The text was updated successfully, but these errors were encountered: