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() exempt — void 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 · ◷
Rule
eslint-factory/src/rules/require-await-core-summary-write.tsProblem
The visitor only inspects an
ExpressionStatementwhose expression is directly aCallExpression(line 92:if (expr.type !== "CallExpression") return;). A discardedcore.summary.write()promise wrapped in another expression form escapes detection: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 areawaited) — this is a preventive hardening of the visitor, matching the branch-order-FN hardening requested for the sibling catch rules.Acceptance criteria
ExpressionStatementexpressions throughLogicalExpression(right operand),ConditionalExpression(both branches), andSequenceExpression(last element) before theCallExpressioncheck.core.summary.write().then(...)chains with no terminalawait/return(flag, or explicitly exempt as "handled").void core.summary.write()exempt —voidis the idiomatic deliberate-discard marker; add a valid-case test asserting it is not flagged.Priority
Medium — preventive, but cheap and closes the obvious escape hatches around an otherwise well-scoped rule.