Skip to main content

SKY-Q410 · Quality, structure and performance

Discarded local async result

Medium

A stable local async callable is invoked as a statement whose promise is discarded. No caller awaits, returns, stores or handles that result, and the call is not explicitly marked void.

Languages
TypeScript, JavaScript
Turned on by
skylos . --quality
Quality gate
counted toward the gate limits (full and diff scans). Reported as quality; counts toward max_quality.
Finding type
defect
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A caller can finish before its work completes, and a rejected promise can go unhandled. An explicit void expression records intentional background work but does not itself handle failures.

What Skylos flags

src/save.ts · TypeScriptReported on line 5
async function persist(): Promise<void> {  throw new Error("disk failure");}export function save(): void {  persist();}

What Skylos leaves alone

src/save.ts · TypeScript
async function persist(): Promise<void> {  throw new Error("disk failure");}export async function save(): Promise<void> {  await persist();}

Why Skylos leaves it alone

Awaiting the promise propagates completion and failure to the caller.

How Skylos decides

  1. Runs with quality analysis on parsed JavaScript/TypeScript source. Generated or incomplete source is not used for this proof.
  2. Resolves a local async declaration or initialized async function, including hoisted declarations and bounded constant aliases. Parameter shadows, conflicting bindings, reassignment and possible closure writes prevent a finding.
  3. Reports MEDIUM only for a direct discarded expression statement, including transparent TypeScript wrappers. Awaited, returned, stored, .catch-handled and explicit void uses stay quiet.
  4. Does not infer external SDK return types, async generators, object methods or arbitrary promise chains. Those forms are outside this bounded local-callable check.

How to fix it

Await or return the promise, or attach a rejection handler. Use void only when the background operation is intentional.

src/save.ts · TypeScript · the fix, against the flagged file
async function persist(): Promise<void> {  throw new Error("disk failure");}Removed: export function save(): void {Removed:   persist();Added: export async function save(): Promise<void> {Added:   await persist();}

When it can be wrong

  • A deliberate background call without explicit void still reports; the tool cannot infer that intent.
  • Imported functions, dynamic methods and unproven return types are outside the check, so a quiet result does not verify every promise in a project.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Set [tool.skylos] ignore = ["SKY-Q410"] to disable this rule project-wide.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.