Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Hello, I think theno-misused-promises
rule could be improved to perform the checks in a few more positions, so here is proposal:
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I haveread the FAQ and my problem is not listed.
Repro
{"rules": {"@typescript-eslint/no-misused-promises":"error" }}
declarefunctiondoSomething(value:unknown):Promise<void>;// Function argument: current version of the rule emits error[1,2,3].forEach(asyncvalue=>{awaitdoSomething(value);});// variable: current version of the rule does NOT emit errorconstfunc:()=>void=async()=>{awaitdoSomething(123);};typeObj={func:()=>void};// Contextually typed property: current version of the rule does NOT emit errorconstobj:Obj={func:async()=>{awaitdoSomething(123);}};constComponent=(obj:Obj)=>null;// JSX prop: current version of the rule does NOT emit error<Componentfunc={async()=>{awaitdoSomething(123);}}/>;
Expected Result
The rule reports error for all cases above.
Actual Result
Error is reported only for the first case.
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.10.2 |
@typescript-eslint/parser | 5.10.2 |
TypeScript | 4.5.5 |
ESLint | 8.8.0 |
node | 16.13.1 |