|
1
|
--- |
|
2
|
sidebar_label: "lint" |
|
3
|
sidebar_position: 6 |
|
4
|
--- |
|
5
|
|
|
6
|
import { Table } from "docs-ui" |
|
7
|
|
|
8
|
export const metadata = { |
|
9
|
title: `lint Command - Medusa CLI Reference`, |
|
10
|
} |
|
11
|
|
|
12
|
# {metadata.title} |
|
13
|
|
|
14
|
<Note> |
|
15
|
|
|
16
|
This command is available since Medusa [v2.16.0](https://github.com/medusajs/medusa/releases/tag/v2.16.0). |
|
17
|
|
|
18
|
</Note> |
|
19
|
|
|
20
|
Lint your project using its ESLint configuration. |
|
21
|
|
|
22
|
```bash npx2yarn |
|
23
|
npx medusa lint |
|
24
|
``` |
|
25
|
|
|
26
|
The command requires a flat ESLint config file (`eslint.config.js`, `eslint.config.mjs`, or similar). Config detection uses ESLint's own resolution, which walks ancestor directories, so a config at a monorepo root applies to nested projects. If no config file is found, the command exits with an error. |
|
27
|
|
|
28
|
The `eslint` package must be installed in your project. It is a peer dependency of `@medusajs/eslint-plugin`. |
|
29
|
|
|
30
|
## Arguments |
|
31
|
|
|
32
|
<Table> |
|
33
|
<Table.Header> |
|
34
|
<Table.Row> |
|
35
|
<Table.HeaderCell> |
|
36
|
Argument |
|
37
|
</Table.HeaderCell> |
|
38
|
<Table.HeaderCell> |
|
39
|
Description |
|
40
|
</Table.HeaderCell> |
|
41
|
</Table.Row> |
|
42
|
</Table.Header> |
|
43
|
<Table.Body> |
|
44
|
<Table.Row> |
|
45
|
<Table.Cell> |
|
46
|
|
|
47
|
`[paths...]` |
|
48
|
|
|
49
|
</Table.Cell> |
|
50
|
<Table.Cell> |
|
51
|
|
|
52
|
Files or directories to lint. Defaults to the whole project. |
|
53
|
|
|
54
|
</Table.Cell> |
|
55
|
</Table.Row> |
|
56
|
</Table.Body> |
|
57
|
</Table> |
|
58
|
|
|
59
|
## Options |
|
60
|
|
|
61
|
<Table> |
|
62
|
<Table.Header> |
|
63
|
<Table.Row> |
|
64
|
<Table.HeaderCell> |
|
65
|
Option |
|
66
|
</Table.HeaderCell> |
|
67
|
<Table.HeaderCell> |
|
68
|
Description |
|
69
|
</Table.HeaderCell> |
|
70
|
<Table.HeaderCell> |
|
71
|
Default |
|
72
|
</Table.HeaderCell> |
|
73
|
</Table.Row> |
|
74
|
</Table.Header> |
|
75
|
<Table.Body> |
|
76
|
<Table.Row> |
|
77
|
<Table.Cell> |
|
78
|
|
|
79
|
`--fix` |
|
80
|
|
|
81
|
</Table.Cell> |
|
82
|
<Table.Cell> |
|
83
|
|
|
84
|
Auto-fix lint issues where possible. |
|
85
|
|
|
86
|
</Table.Cell> |
|
87
|
<Table.Cell> |
|
88
|
|
|
89
|
`false` |
|
90
|
|
|
91
|
</Table.Cell> |
|
92
|
</Table.Row> |
|
93
|
<Table.Row> |
|
94
|
<Table.Cell> |
|
95
|
|
|
96
|
`--quiet` |
|
97
|
|
|
98
|
</Table.Cell> |
|
99
|
<Table.Cell> |
|
100
|
|
|
101
|
Report lint errors only, suppressing warnings. |
|
102
|
|
|
103
|
</Table.Cell> |
|
104
|
<Table.Cell> |
|
105
|
|
|
106
|
`false` |
|
107
|
|
|
108
|
</Table.Cell> |
|
109
|
</Table.Row> |
|
110
|
</Table.Body> |
|
111
|
</Table> |
|
112
|
|
|
113
|
## Exit Codes |
|
114
|
|
|
115
|
The command exits with code `1` when lint errors are found. It exits with code `0` when only warnings are produced or no issues are found. |