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

Rule proposal: no-single-promise-in-promise-methods #2256

Closed
Clement398 opened this issue Jan 13, 2024 · 2 comments · Fixed by #2258
Closed

Rule proposal: no-single-promise-in-promise-methods #2256

Clement398 opened this issue Jan 13, 2024 · 2 comments · Fixed by #2258

Comments

@Clement398
Copy link
Contributor

Clement398 commented Jan 13, 2024

Description

Disallow using Promise method with a single element array as parameter.

Fail

Promise.all([promise]);

Promise.any([promise]);

Promise.race([promise]);

Pass

Promise.all([promise, anotherPromise]);
Promise.all(notArrayLiteral);
Promise.all([...promises]);

Promise.any([promise, anotherPromise]);

Promise.race([promise, anotherPromise]);

Promise.allSettled([promise]);

Additional Info

No response

@sindresorhus
Copy link
Owner

sindresorhus commented Jan 13, 2024

This should be more general and also apply to Promise.allSettled and Promise.race.

So please propose a more general name too.

@Clement398 Clement398 changed the title Rule proposal: no-single-promise-in-promise-all Rule proposal: no-single-promise-in-promise-methods Jan 13, 2024
@Clement398
Copy link
Contributor Author

It's edited, thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants