Bug: [no-extra-parens] incorrect precedence for await vs assertion #5124
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
formatting
Related to whitespace/bracket formatting. We strongly recommend you use a formatter instead.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.7.2&sourceType=module&code=IYZwngdgxgBAZgV2gFwJYHsLwBTIBaoQDmAXDMBGAJQwDeAUDOQO7CrIy4HHkgwAKAJ3QBbVCACmAHgBu6VABMAfFQDc9AL70gA&eslintrc=N4KAkARApgHgLlAdgEwM4QFwAIDa5IAOANgK4DmAlohgAJwCeBUqAxgE4UFwC0zRVcAPR8B3NlBYB7ALbSkyKMggAafBGLkqtBk1YcuvVP0RCAhkSIQQWLAF1VNiGxJFmmLKBuO6jZu048IiaCiJLc0hSoJKiK3ARsMpFu2HheXtBsCWwq1mkeuXlYECwAFhIA1qgAapIUyABKUHAkbIjuAGbmMQVeAL499j0QPrr+BkFCobzwbKZxpuKI6Ck9jlCZktkD1v29QA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkAhqqrAO4BSZlemArugDTgaMABbpoAa3YUwAMwYl+g2iXHJEAGWQAjAMKiJ0rrwE0oRWAFF4yPIZ6LTkACYsiGAG7pUASTxY6BMR2xkpQJLDcmNDoALJ0iMEOQiRcyNC2nPYmQubeSKhpNgCCRACeidnKqekActyMemLiHGBGSbS5+YV4ACrCyC1yqAqVZrAAqkTcCk7qsNDyFaGQ5pPT6E4ACnSYdPDofpiD8u1jeYgF0DYASgeRpEuO5gBiDKh4wpgRAObCOnQKEjeIgAZWYNmgwkeOQmREhTQ2wKc6AAHhsitBoiRjsNTpB1pNxOZmERgf88JCAGo7ZB0LQYFptUaQVF0dK4QJEBibL6ILB4Uo9Up8nEjZboEgxWBOeroYGHWAJTIhRzI6CoHYBQhEaRDMWOZBIWCYPAACS8fKO0NoeB23wO0hZJAATAAGACMAHZIMz4NLZY6JURUbZmQArEgox2YdBs0PLLQA9DjTCoR0AOnTAHofcsIngACLITAZ7N+JC5xwxv2eHQIfZEPCM+yCAC+2RgCBQGGwoLonl1Jw7yDhqG4yOkAG1liQolmAFTzheVoR+FJZ7hEGxrvALpfzyCCAC6HdR6vH6Cny3MyIA+n6ZQzDxAjyBW0A
Repro Code
ESLint Config
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
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
@typescript-eslint/eslint-plugin
5.27.0
@typescript-eslint/parser
5.27.0
TypeScript
4.7.2
ESLint
8.15.0
node
web
The text was updated successfully, but these errors were encountered: