1 ---
2 sidebar_label: "scheduled-job-name-unique"
3 ---
4
5 import { Note } from "docs-ui"
6
7 export const metadata = {
8 title: `scheduled-job-name-unique - ESLint plugin rules`,
9 }
10
11 # {metadata.title}
12
13 This rule requires a scheduled job's `config.name` to be unique across all scheduled jobs in the project.
14
15 ## Severity
16
17 `error`. This rule is enabled in the [strict](../../page.mdx#strict) preset.
18
19 By default, Medusa projects use the [recommended](../../page.mdx#recommended) preset, which doesn't enable this rule. To use it, switch to the [strict](../../page.mdx#strict) preset.
20
21 ## What it Targets
22
23 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.
24
25 The following code is reported by the rule when another job already uses the name `sync-products`:
26
27 ```ts title="src/jobs/sync-products-copy.ts"
28 export default async function () {}
29
30 export const config = {
31 name: "sync-products",
32 schedule: "0 0 * * *",
33 }
34 ```
35
36 Instead, give the job a unique name:
37
38 ```ts title="src/jobs/sync-products-copy.ts"
39 export default async function () {}
40
41 export const config = {
42 name: "sync-products-copy",
43 schedule: "0 0 * * *",
44 }
45 ```
46
47 ## Why it's Important
48
49 Medusa identifies each scheduled job by its `name`. Two jobs sharing a name conflict with each other, so only one is registered.
50
51 Learn more in the [Scheduled Jobs documentation](!docs!/learn/fundamentals/scheduled-jobs).
52
53 ## Fixable
54
55 This rule isn't auto-fixable.