Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Understanding no-floating-promises#8046

Closed
GZLiew started this conversation inTechnical Discussions
Discussion options

Body

Hi I added the@typescript-eslint/no-floating-promises rule to my code base but why does the following code not error ?

'@typescript-eslint/no-floating-promises': 'error',
exportconstsleep=(ms=3000)=>newPromise((resolve)=>setTimeout(resolve,ms));consta=sleep();

but calling only sleep() errors

sleep();// Promises must be awaited

Additional Info

No response

Before you submit your discussion, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you!

You must be logged in to vote

Replies: 2 comments

Comment options

The rule assumes your variable will be used and handled appropriately.
Unused variables can be caught using theno-unused-vars rule.

You must be logged in to vote
0 replies
Comment options

Looks like this was a straightforward resolution 🙂. Thanks all!

Filed#8088 to improve docs around this.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@GZLiew@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp