Skip to content

require-await-core-summary-write: misses discarded promise in non-bare-call statement positions #43326

Description

@github-actions

Rule

eslint-factory/src/rules/require-await-core-summary-write.ts

Problem

The visitor only inspects an ExpressionStatement whose expression is directly a CallExpression (line 92: if (expr.type !== "CallExpression") return;). A discarded core.summary.write() promise wrapped in another expression form escapes detection:

async function f() {
  cond && core.summary.write();        // LogicalExpression  -> FN
  cond ? core.summary.write() : noop(); // ConditionalExpression -> FN
  (log(), core.summary.write());        // SequenceExpression -> FN
  core.summary.write().then(() => {});  // callee prop is `then`, not `write` -> FN, still never awaited
}

Each still drops the Promise<Summary> on the floor exactly like the bare form the rule already catches.

Status

No live site in the corpus uses these forms today (all summary.write() calls are awaited) — this is a preventive hardening of the visitor, matching the branch-order-FN hardening requested for the sibling catch rules.

Acceptance criteria

  • Unwrap ExpressionStatement expressions through LogicalExpression (right operand), ConditionalExpression (both branches), and SequenceExpression (last element) before the CallExpression check.
  • Decide and document handling for core.summary.write().then(...) chains with no terminal await/return (flag, or explicitly exempt as "handled").
  • Keep void core.summary.write() exemptvoid is the idiomatic deliberate-discard marker; add a valid-case test asserting it is not flagged.
  • Add invalid-case tests for the Logical / Conditional / Sequence repros above.

Priority

Medium — preventive, but cheap and closes the obvious escape hatches around an otherwise well-scoped rule.

Generated by 🤖 ESLint Refiner · 158.7 AIC · ⌖ 12.5 AIC · ⊞ 4.7K ·

  • expires on Jul 10, 2026, 10:23 PM UTC-08:00

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions