step-must-return-step-response - ESLint plugin rules

This rule requires a createStep callback that returns a value to wrap it in new StepResponse(...).

Severity#

error. This rule is enabled in the recommended preset.

What it Targets#

This rule targets files in your project's src/workflows directory. It reports a createStep function that returns a value not wrapped in new StepResponse(...).

The following code is reported by the rule:

src/workflows/example.ts
1import { createStep } from "@medusajs/framework/workflows-sdk"2
3createStep("s", (input) => {4  return { ok: true }5})

Instead, wrap the return value in new StepResponse(...):

src/workflows/example.ts
1import {2  createStep,3  StepResponse,4} from "@medusajs/framework/workflows-sdk"5
6createStep("s", (input) => {7  return new StepResponse({ ok: true })8})

The rule also allows returning StepResponse.skip(), which skips the step's execution:

src/workflows/example.ts
1import {2  createStep,3  StepResponse,4} from "@medusajs/framework/workflows-sdk"5
6createStep("s", (input) => {7  return StepResponse.skip()8})

Why it's Important#

A step's return value must be a StepResponse so the workflow engine can pass it to the next step and store the compensation data. Returning a plain value breaks this contract.

Learn more in the Workflows documentation.

Fixable#

This rule is auto-fixable. Run the linter with the --fix option to apply the fix automatically.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵