1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const optionator = require("optionator");
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | module.exports = optionator({
|
20 | prepend: "eslint [options] file.js [file.js] [dir]",
|
21 | defaults: {
|
22 | concatRepeatedArrays: true,
|
23 | mergeRepeatedObjects: true
|
24 | },
|
25 | options: [
|
26 | {
|
27 | heading: "Basic configuration"
|
28 | },
|
29 | {
|
30 | option: "eslintrc",
|
31 | type: "Boolean",
|
32 | default: "true",
|
33 | description: "Disable use of configuration from .eslintrc.*"
|
34 | },
|
35 | {
|
36 | option: "config",
|
37 | alias: "c",
|
38 | type: "path::String",
|
39 | description: "Use this configuration, overriding .eslintrc.* config options if present"
|
40 | },
|
41 | {
|
42 | option: "env",
|
43 | type: "[String]",
|
44 | description: "Specify environments"
|
45 | },
|
46 | {
|
47 | option: "ext",
|
48 | type: "[String]",
|
49 | default: ".js",
|
50 | description: "Specify JavaScript file extensions"
|
51 | },
|
52 | {
|
53 | option: "global",
|
54 | type: "[String]",
|
55 | description: "Define global variables"
|
56 | },
|
57 | {
|
58 | option: "parser",
|
59 | type: "String",
|
60 | description: "Specify the parser to be used"
|
61 | },
|
62 | {
|
63 | option: "parser-options",
|
64 | type: "Object",
|
65 | description: "Specify parser options"
|
66 | },
|
67 | {
|
68 | heading: "Specifying rules and plugins"
|
69 | },
|
70 | {
|
71 | option: "rulesdir",
|
72 | type: "[path::String]",
|
73 | description: "Use additional rules from this directory"
|
74 | },
|
75 | {
|
76 | option: "plugin",
|
77 | type: "[String]",
|
78 | description: "Specify plugins"
|
79 | },
|
80 | {
|
81 | option: "rule",
|
82 | type: "Object",
|
83 | description: "Specify rules"
|
84 | },
|
85 | {
|
86 | heading: "Fixing problems"
|
87 | },
|
88 | {
|
89 | option: "fix",
|
90 | type: "Boolean",
|
91 | default: false,
|
92 | description: "Automatically fix problems"
|
93 | },
|
94 | {
|
95 | option: "fix-dry-run",
|
96 | type: "Boolean",
|
97 | default: false,
|
98 | description: "Automatically fix problems without saving the changes to the file system"
|
99 | },
|
100 | {
|
101 | option: "fix-type",
|
102 | type: "Array",
|
103 | description: "Specify the types of fixes to apply (problem, suggestion, layout)"
|
104 | },
|
105 | {
|
106 | heading: "Ignoring files"
|
107 | },
|
108 | {
|
109 | option: "ignore-path",
|
110 | type: "path::String",
|
111 | description: "Specify path of ignore file"
|
112 | },
|
113 | {
|
114 | option: "ignore",
|
115 | type: "Boolean",
|
116 | default: "true",
|
117 | description: "Disable use of ignore files and patterns"
|
118 | },
|
119 | {
|
120 | option: "ignore-pattern",
|
121 | type: "[String]",
|
122 | description: "Pattern of files to ignore (in addition to those in .eslintignore)",
|
123 | concatRepeatedArrays: [true, {
|
124 | oneValuePerFlag: true
|
125 | }]
|
126 | },
|
127 | {
|
128 | heading: "Using stdin"
|
129 | },
|
130 | {
|
131 | option: "stdin",
|
132 | type: "Boolean",
|
133 | default: "false",
|
134 | description: "Lint code provided on <STDIN>"
|
135 | },
|
136 | {
|
137 | option: "stdin-filename",
|
138 | type: "String",
|
139 | description: "Specify filename to process STDIN as"
|
140 | },
|
141 | {
|
142 | heading: "Handling warnings"
|
143 | },
|
144 | {
|
145 | option: "quiet",
|
146 | type: "Boolean",
|
147 | default: "false",
|
148 | description: "Report errors only"
|
149 | },
|
150 | {
|
151 | option: "max-warnings",
|
152 | type: "Int",
|
153 | default: "-1",
|
154 | description: "Number of warnings to trigger nonzero exit code"
|
155 | },
|
156 | {
|
157 | heading: "Output"
|
158 | },
|
159 | {
|
160 | option: "output-file",
|
161 | alias: "o",
|
162 | type: "path::String",
|
163 | description: "Specify file to write report to"
|
164 | },
|
165 | {
|
166 | option: "format",
|
167 | alias: "f",
|
168 | type: "String",
|
169 | default: "stylish",
|
170 | description: "Use a specific output format"
|
171 | },
|
172 | {
|
173 | option: "color",
|
174 | type: "Boolean",
|
175 | alias: "no-color",
|
176 | description: "Force enabling/disabling of color"
|
177 | },
|
178 | {
|
179 | heading: "Inline configuration comments"
|
180 | },
|
181 | {
|
182 | option: "inline-config",
|
183 | type: "Boolean",
|
184 | default: "true",
|
185 | description: "Prevent comments from changing config or rules"
|
186 | },
|
187 | {
|
188 | option: "report-unused-disable-directives",
|
189 | type: "Boolean",
|
190 | default: false,
|
191 | description: "Adds reported errors for unused eslint-disable directives"
|
192 | },
|
193 | {
|
194 | heading: "Caching"
|
195 | },
|
196 | {
|
197 | option: "cache",
|
198 | type: "Boolean",
|
199 | default: "false",
|
200 | description: "Only check changed files"
|
201 | },
|
202 | {
|
203 | option: "cache-file",
|
204 | type: "path::String",
|
205 | default: ".eslintcache",
|
206 | description: "Path to the cache file. Deprecated: use --cache-location"
|
207 | },
|
208 | {
|
209 | option: "cache-location",
|
210 | type: "path::String",
|
211 | description: "Path to the cache file or directory"
|
212 | },
|
213 | {
|
214 | heading: "Miscellaneous"
|
215 | },
|
216 | {
|
217 | option: "init",
|
218 | type: "Boolean",
|
219 | default: "false",
|
220 | description: "Run config initialization wizard"
|
221 | },
|
222 | {
|
223 | option: "debug",
|
224 | type: "Boolean",
|
225 | default: false,
|
226 | description: "Output debugging information"
|
227 | },
|
228 | {
|
229 | option: "help",
|
230 | alias: "h",
|
231 | type: "Boolean",
|
232 | description: "Show help"
|
233 | },
|
234 | {
|
235 | option: "version",
|
236 | alias: "v",
|
237 | type: "Boolean",
|
238 | description: "Output the version number"
|
239 | },
|
240 | {
|
241 | option: "print-config",
|
242 | type: "path::String",
|
243 | description: "Print the configuration for the given file"
|
244 | }
|
245 | ]
|
246 | });
|