Rule/Perf: Reduce allocations in no-floating-promises
Author: DanielRosenwasserCreated Jul 30, 2026Updated Sep 14, 2026
Labelsrepo maintenanceaccepting prs
AI Assistance
- If I used AI assistance to prepare this issue, I have reviewed and followed the AI Contribution Policy.
Suggestion
In no-floating-promises, every ExpressionStatement invokes isUnhandledPromise, which recursively walks the tree. As it does, it reports information in the form of an object. These objects contain up to 3 boolean properties which are not always set.
function isUnhandledPromise(
checker: ts.TypeChecker,
node: TSESTree.Node,
): {
isUnhandled: boolean;
nonFunctionHandler?: boolean;
promiseArray?: boolean;
}I have not measured the cost yet, but instead of returning a new object with varying shapes, I figured these could be represented as bit flags on a small int.
Additional Info
No response
Source: typescript-eslint/typescript-eslint