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:
Instead, wrap the return value in new StepResponse(...):
The rule also allows returning StepResponse.skip(), which skips the step's execution:
src/workflows/example.ts1import {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.