scheduled-job-default-export-async - ESLint plugin rules
This rule requires the default-exported scheduled job function to be async.
Severity#
error. This rule is enabled in the recommended preset.
What it Targets#
This rule targets files at any depth in your project's src/jobs directory, except index files, files whose names start with _, and .d.ts files, which Medusa doesn't load as scheduled jobs. It reports a default-exported scheduled job that isn't an async function.
The following code is reported by the rule:
Instead, make the job function async:
Why it's Important#
Scheduled jobs receive the Medusa container and are always awaited by Medusa. Making the job async ensures Medusa can wait for its work to finish before continuing.
Learn more in the Scheduled Jobs documentation.
Fixable#
This rule is auto-fixable. Run the linter with the --fix option to apply the fix automatically.