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: [promise-function-async] fixer generates invalid syntax with override keyword #11729

Open
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@sushichan044

Description

@sushichan044

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=5.9.3&fileType=.ts&code=MYGwhgzhAEBCkFNoG8BQ1qQJ4DtjQDMB7IgCgEoV0NoAnBAFwFdadoAFWogWwEsIEAOnoQiIAG4JSAFgBM5ANzUAvqlWpQkGABEEtXpIAm0BAA8GCHIZjwBVDEUm19hpMTKU0NOoxZtOPPxCImKSpLIADFHkKmpAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6AewFtLlFaAM1hMy%2BSpya0AhskKj0URNC7RI4MAF8QmoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

classBase{asyncfoo(){returnPromise.resolve(42);}}classDerivedextendsBase{overridefoo(){returnPromise.resolve(2000)}}

ESLint Config

module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/promise-function-async":"error"}};

tsconfig

{"compilerOptions": {// ...  }}

Expected Result

The fixer should produce valid TypeScript syntax with the async keyword placed after the override modifier, following TypeScript's correct modifier order.

classBase{asyncfoo(){returnPromise.resolve(42);}}classDerivedextendsBase{overrideasyncfoo(){returnPromise.resolve(2000)}}

Actual Result

The fixer generates invalid syntax by placing the async keyword before the override modifier, which violates TypeScript's modifier ordering rules and causes a syntax error.

classBase{asyncfoo(){returnPromise.resolve(42);}}classDerivedextendsBase{asyncoverridefoo(){returnPromise.resolve(2000)}}

Additional Info

The root cause is that the fixer's token-skipping logic only handles Keyword type tokens such as public and static, but TypeScript's override is classified as an Identifier token.
This causes the insertion point to be calculated incorrectly, resulting in invalid modifier ordering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: 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