API Reference@use-crux/coreIndex Lints
runtime.closure_defer
What it checks
Crux emits this finding when flow.defer() receives an inline function instead of an exported durableTask() target.
Why it matters
Durable background work must be importable and wakeable after the current process exits. Inline closures are request-scoped code.
How to fix
Move durable wakeable work into durableTask("name", { run }) from
@use-crux/core/runtime and schedule it with flow.defer(target, input).
For request-scoped (non-durable) post-response work outside flows, use public
defer(callback) behind a host wrapper, see Request-scoped defer.
When to suppress
Suppress only while migrating code that is covered by runtime tests and not deployed with durable wake.
Rule metadata
- Rule id:
runtime.closure_defer - Category:
runtime - Maturity:
stable - Default profiles:
recommended,strict - Default severity:
error