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

Enhancement: [no-floating-promises] Check PromiseLike in addition to Promise by default #9869

Closed as not planned
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleevaluating community engagementwe're looking for community engagement on this issue to show that this problem is widely importantlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/no-floating-promises

Description

As of#8433 ->#9263,no-floating-promises has acheckThenables option (enabled by default as of v8) that stops it from flagging anything that's not explicitly aPromise type. That means the rule won't flag something that's explicitly marked as typePromiseLike (rather thanPromise) without explicitly enablingcheckThenables.

Coming out of conversation with@jakebailey:PromiseLike does semantically indicate a value is intended to be usedlike aPromise. That's different from something that coincidentally has a.then() which can be used withawait (🤯).

Proposal: should we have the rulealso check forPromiseLike, in addition toPromise?

Fail

declarefunctioncreateThenable():PromiseLike<void>;createThenable();

Pass

declarefunctioncreateThenable():{then(a:()=>void,b:()=>void):void}createThenable();

Additional Info

I'm in favor of this personally, for the stated reasoning.

In terms of whether this would be a breaking change: it almost feels like abugfix rather than afeature?PromiseLike is quite rare in real-world usage. If this is accepted, I'd also be in favor of landing it in a minor version rather than a major.

💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleevaluating community engagementwe're looking for community engagement on this issue to show that this problem is widely importantlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.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