-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
async function f(thing: any) {
await (thing as Promise<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 our relatively 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 |
armano2 and soobing
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin