Skip to main content

Async Patterns

Off by default (modules.async_patterns = true to enable). Detects async/await anti-patterns in JavaScript, TypeScript, and Python. Prefix: ASYNC-

FindingSeverityWhat it matches
ASYNC-001ErrorAsync function passed to Promise executor
ASYNC-002ErrorforEach with async callback
ASYNC-003WarningUnhandled .then() chain (no .catch())
ASYNC-004Warningasync in .map() without Promise.all
ASYNC-005WarningAsync callback in setTimeout/setInterval
ASYNC-006WarningFloating Python coroutine (not awaited)
ASYNC-007InfoEmpty .catch(() => {}) swallowing errors
ASYNC-008InfoRedundant return await inside async
// Bad — ASYNC-002
items.forEach(async (item) => {
await process(item); // errors are lost
});

// Good
await Promise.all(items.map(item => process(item)));

// Bad — ASYNC-004
const results = items.map(async (item) => { ... });
// results is Promise<...>[], not resolved values

// Good
const results = await Promise.all(items.map(async (item) => { ... }));