Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: [no-extra-parens] incorrect precedence for await vs assertion #5124

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@bradzacher

Description

@bradzacher

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

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

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

packageversion
@typescript-eslint/eslint-plugin5.27.0
@typescript-eslint/parser5.27.0
TypeScript4.7.2
ESLint8.15.0
nodeweb

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingformattingRelated to whitespace/bracket formatting. We strongly recommend you use a formatter instead.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp