Size / Priority
- Size: Trivial (~30+ sites)
- Category: C.2 Simplifications & DRY.
- Risk: low.
Affected files
- Across the codebase — sites using
void this.foo() to mark fire-and-forget Promise calls.
Background
JavaScript Promise gotcha: an unawaited Promise that rejects produces an unhandled-rejection. TypeScript's no-floating-promises lint rule warns on this.
The conventional workaround is void promise to signal "I'm intentionally ignoring this":
void this._dispatchOne(env); // fire-and-forget — caller doesn't await
The pattern is fine but appears ~30+ times without consistent comments. A casual reader doesn't always understand whether void was added to suppress a lint warning or because the Promise's rejection is being silently swallowed (which is a bug — should always be caught).
Target
Convention:
void promise; /* fire-and-forget */ with explicit comment — preferred.
promise.catch(e => this.log.warn(...)) — when rejection should be logged.
- Custom helper for repeated patterns:
// src/util/Async.ts (new)
/** Run a Promise fire-and-forget with a logging fallback. */
export function fireAndForget<T>(p: Promise<T>, label: string, log: Logger): void {
p.catch(e => log.warn(`[fire-and-forget] ${label}: ${(e as Error).message}`));
}
Lint rule: enforce that void is accompanied by a comment OR the Promise is .catch()-handled.
Integration / risk
- No behavioural change.
- Helps reviewers spot accidentally-swallowed errors.
Test plan
- Lint configuration update.
- Per-site review: each
void promise documented or migrated to fireAndForget.
Acceptance criteria
Size / Priority
Affected files
void this.foo()to mark fire-and-forget Promise calls.Background
JavaScript Promise gotcha: an unawaited Promise that rejects produces an unhandled-rejection. TypeScript's
no-floating-promiseslint rule warns on this.The conventional workaround is
void promiseto signal "I'm intentionally ignoring this":The pattern is fine but appears ~30+ times without consistent comments. A casual reader doesn't always understand whether
voidwas added to suppress a lint warning or because the Promise's rejection is being silently swallowed (which is a bug — should always be caught).Target
Convention:
void promise; /* fire-and-forget */with explicit comment — preferred.promise.catch(e => this.log.warn(...))— when rejection should be logged.Lint rule: enforce that
voidis accompanied by a comment OR the Promise is.catch()-handled.Integration / risk
Test plan
void promisedocumented or migrated tofireAndForget.Acceptance criteria
void Promisedocumented.fireAndForgethelper exported.