www/apps/resources/app/lint/rules/scheduled-job-name-unique/page.mdx
import { Note } from "docs-ui"
export const metadata = {
title: scheduled-job-name-unique - ESLint plugin rules,
}
This rule requires a scheduled job's config.name to be unique across all scheduled jobs in the project.
error. This rule is enabled in the strict preset.
By default, Medusa projects use the recommended preset, which doesn't enable this rule. To use it, switch to the strict preset.
This rule targets files in your project's src/jobs directory. It reports a config.name that's already used by another scheduled job file.
The following code is reported by the rule when another job already uses the name sync-products:
export default async function () {}
export const config = {
name: "sync-products",
schedule: "0 0 * * *",
}
Instead, give the job a unique name:
export default async function () {}
export const config = {
name: "sync-products-copy",
schedule: "0 0 * * *",
}
Medusa identifies each scheduled job by its name. Two jobs sharing a name conflict with each other, so only one is registered.
Learn more in the Scheduled Jobs documentation.
This rule isn't auto-fixable.