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

Can this plugin prevent promises that resolve to promises? #153

Open
fantapop opened this issue Nov 20, 2018 · 3 comments
Open

Can this plugin prevent promises that resolve to promises? #153

fantapop opened this issue Nov 20, 2018 · 3 comments

Comments

@fantapop
Copy link

Is there a way to enforce that async functions do not return a promise? For example, I'd like to enforce we don't have code like this:

async function publishUser(user) {
 /// something async
}

async function publishAllUsers() {
    const users = await fetchUsersToPublish();
    return Promise.all(users.map(publishUser));
}

in favor of this:

async function getUserDetails() {
    const users = await fetchUsersToPublish();
    await Promise.all(users.map(publishUser));
}
@xjamundx
Copy link
Contributor

Did you mean return await here?

@fantapop
Copy link
Author

Oops yes.

@brettz9
Copy link
Member

brettz9 commented Jul 20, 2024

So looks like a version of https://typescript-eslint.io/rules/return-await/ .

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

4 participants