tools icon indicating copy to clipboard operation
tools copied to clipboard

`noFloatingPromises`, typescript-eslint/no-floating-promises

Open jpike88 opened this issue 2 years ago • 6 comments

Description

https://typescript-eslint.io/rules/no-floating-promises

important would be have the ignoreVoid enabled, as adding void before a Promise can explicitly define that Promise as one that is not designed to be awaited and blocking the function's execution.

jpike88 avatar Jan 23 '23 08:01 jpike88

this rule is critical for our projects, it prevents some very nasty situations from occurring, as floating promises can cause sync issues with our data model.

jpike88 avatar Jan 23 '23 08:01 jpike88

This would definitely help catch weird runtime errors. Looking forward to it’s support!

mphill avatar Mar 02 '23 12:03 mphill

Unfortunately the rule implementation requires information about types. I'm afraid that we can't implement it fully without a compiler.

denbezrukov avatar Mar 02 '23 13:03 denbezrukov

I understand. This rule is actually so critical that I think I'm going to bring back eslint into our CI tests just for that rule alone.

jpike88 avatar Mar 03 '23 06:03 jpike88

I actually think that this would be the answer, not something a linter should handle as it fundamentally can change the behaviour or the code. Don't really know if it's a linter's place to be reaching that far.

https://github.com/microsoft/TypeScript/issues/13376

Can close this if you like

jpike88 avatar Mar 27 '23 05:03 jpike88

This rule is very important for us too and it is also 2-3x slower than any other rule we have enabled in eslint. I am happy to use a mix of eslint and rome as needed but a Rust implementation of this rule seems like it would have a significant impact to our lint times.

public avatar Jun 14 '23 09:06 public