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
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
asyncfunctionf(thing:any){await(thingasPromise<void>);}
ESLint Config
module.exports={"extends":["plugin:@typescript-eslint/eslint-recommended","plugin:@typescript-eslint/all"],"rules":{"@typescript-eslint/no-misused-promises":["error",{"checksVoidReturn":false}],"@typescript-eslint/no-extra-parens":["error"]}}
tsconfig
No response
Expected Result
No error as these are necessary parentheses in order to ensure the assertion is applied to the await argument, not the await result.
Actual Result
Unnecessary parentheses around expression. 2:9 - 2:10
Additional Info
Found in#5121 cc@doberkofler
A big problem that I can see is that this rule uses our old-school hack-and-extend method for extending the lint rule.
Instead we should fork the lint rule and leverage ourrelatively new precedence utilities in order to correctly understand all cases.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.27.0 |
@typescript-eslint/parser | 5.27.0 |
TypeScript | 4.7.2 |
ESLint | 8.15.0 |
node | web |