-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Improvement jsdoc/require-returns rule #518
Comments
Closing as I think that should address, but feel free to comment further and clarify if I have misunderstood. |
@brettz9 I think that may I didn't explain the issue well. What I'm trying to explain is that we have both cases: /**
* Do something.
*
* @throws {Error} If something bad occurs.
*/
async function doBar(): Promise<void> {
// Do something.
}
/**
* Do something.
*
* @returns The promise that is resolved once something is completed.
*
* @throws {Error} If something bad occurs.
*/
async function doBaz(): Promise<void> {
return new Promise<void>((resolve, reject) => {
// For some reason its more convenient at some point to return a contruction like this.
});
} Sometimes it's convenient to write the function like in To make it consistent, we turn on |
There may be some cases where a |
🎉 This issue has been resolved in version 25.4.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The current
jsdoc/require-returns
implementation depends on the presence of a return statement, but an inconsistent case remains even whenforceReturnsWithAsync
is set totrue
.It will be nice, at least in Typescript, to detect when async/await is used and the return is Promise<void> type. It strange and not very insightful document this case just because the type change from void to Promise. For example:
To me all methods are similar in structure and documentation. However, the rule makes mandatory to document the result in
doBar()
and/ordoBaz()
.It would be nice if you can configure the rule to avoid having to document Promise<void> return when using async / wait.
The text was updated successfully, but these errors were encountered: