Enhancement: [no-floating-promises] Provide a built-in SafePromise type
DRANK
Before You File a Proposal Please Confirm You Have Done The Following... I have searched for related issues and found none that match my proposal. I have searched the current rule list and found no rules that match my proposal. I have read the FAQ and my problem is not listed. 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 Coming over from discussions such as #5844, #7008, #8404, https://github.com/reduxjs/redux-toolkit/issues/4101, https://github.com/fastify/fastify/issues/5498, https://github.com/typescript-eslint/typescript-eslint/issues/9869: one known user pain with @typescript-eslint/no-floating-promises is around frameworks/libraries that intentionally make "fire-and-forget" Promises. If a function's calls don't need an await by design, it's inconvenient to have the rule report on them by default. The allowForKnownSafeCalls and allowForKnownSafePromises rule options make this better, but also require user linter configuration. For example, Redux Toolkit added a SafePromise type per allowForKnownSafePromises. Users can allowlist that type in their ESLint configs. This works but is inconvenient. Most users don't want to deeply hand-edit their ESLint configs for frameworks-specific nuances like this. We are occasionally asked: can typescript-eslint provide its own SafePromise type that frameworks can use, and that no-floating-promises would allowlist/ignore by default? Fail declare function fromFramework(): Promise<void>; await fromFramework(); // ❌ Lint report from no-floating-promises Pass import { SafePromise } from "@typescript-eslint/types"; declare function fromFramework(): SafePromise<void>; await fromFramework(); // ✅ No report Additional Info I don't see an issue like this in our issue tracker, but know it's been suggested in at least some DMs to me. So I'm surfacing it here on behalf of users. 💖
👀 github.com/typescript-esl…