massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / eslint / lib / options.js
1 /**
2  * @fileoverview Options configuration for optionator.
3  * @author George Zahariev
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Requirements
10 //------------------------------------------------------------------------------
11
12 const optionator = require("optionator");
13
14 //------------------------------------------------------------------------------
15 // Typedefs
16 //------------------------------------------------------------------------------
17
18 /**
19  * The options object parsed by Optionator.
20  * @typedef {Object} ParsedCLIOptions
21  * @property {boolean} cache Only check changed files
22  * @property {string} cacheFile Path to the cache file. Deprecated: use --cache-location
23  * @property {string} [cacheLocation] Path to the cache file or directory
24  * @property {"metadata" | "content"} cacheStrategy Strategy to use for detecting changed files in the cache
25  * @property {boolean} [color] Force enabling/disabling of color
26  * @property {string} [config] Use this configuration, overriding .eslintrc.* config options if present
27  * @property {boolean} debug Output debugging information
28  * @property {string[]} [env] Specify environments
29  * @property {boolean} envInfo Output execution environment information
30  * @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched
31  * @property {boolean} eslintrc Disable use of configuration from .eslintrc.*
32  * @property {string[]} [ext] Specify JavaScript file extensions
33  * @property {boolean} fix Automatically fix problems
34  * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system
35  * @property {("problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (problem, suggestion, layout)
36  * @property {string} format Use a specific output format
37  * @property {string[]} [global] Define global variables
38  * @property {boolean} [help] Show help
39  * @property {boolean} ignore Disable use of ignore files and patterns
40  * @property {string} [ignorePath] Specify path of ignore file
41  * @property {string[]} [ignorePattern] Pattern of files to ignore (in addition to those in .eslintignore)
42  * @property {boolean} init Run config initialization wizard
43  * @property {boolean} inlineConfig Prevent comments from changing config or rules
44  * @property {number} maxWarnings Number of warnings to trigger nonzero exit code
45  * @property {string} [outputFile] Specify file to write report to
46  * @property {string} [parser] Specify the parser to be used
47  * @property {Object} [parserOptions] Specify parser options
48  * @property {string[]} [plugin] Specify plugins
49  * @property {string} [printConfig] Print the configuration for the given file
50  * @property {boolean | undefined} reportUnusedDisableDirectives Adds reported errors for unused eslint-disable directives
51  * @property {string} [resolvePluginsRelativeTo] A folder where plugins should be resolved from, CWD by default
52  * @property {Object} [rule] Specify rules
53  * @property {string[]} [rulesdir] Use additional rules from this directory
54  * @property {boolean} stdin Lint code provided on <STDIN>
55  * @property {string} [stdinFilename] Specify filename to process STDIN as
56  * @property {boolean} quiet Report errors only
57  * @property {boolean} [version] Output the version number
58  * @property {string[]} _ Positional filenames or patterns
59  */
60
61 //------------------------------------------------------------------------------
62 // Initialization and Public Interface
63 //------------------------------------------------------------------------------
64
65 // exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
66 module.exports = optionator({
67     prepend: "eslint [options] file.js [file.js] [dir]",
68     defaults: {
69         concatRepeatedArrays: true,
70         mergeRepeatedObjects: true
71     },
72     options: [
73         {
74             heading: "Basic configuration"
75         },
76         {
77             option: "eslintrc",
78             type: "Boolean",
79             default: "true",
80             description: "Disable use of configuration from .eslintrc.*"
81         },
82         {
83             option: "config",
84             alias: "c",
85             type: "path::String",
86             description: "Use this configuration, overriding .eslintrc.* config options if present"
87         },
88         {
89             option: "env",
90             type: "[String]",
91             description: "Specify environments"
92         },
93         {
94             option: "ext",
95             type: "[String]",
96             description: "Specify JavaScript file extensions"
97         },
98         {
99             option: "global",
100             type: "[String]",
101             description: "Define global variables"
102         },
103         {
104             option: "parser",
105             type: "String",
106             description: "Specify the parser to be used"
107         },
108         {
109             option: "parser-options",
110             type: "Object",
111             description: "Specify parser options"
112         },
113         {
114             option: "resolve-plugins-relative-to",
115             type: "path::String",
116             description: "A folder where plugins should be resolved from, CWD by default"
117         },
118         {
119             heading: "Specifying rules and plugins"
120         },
121         {
122             option: "rulesdir",
123             type: "[path::String]",
124             description: "Use additional rules from this directory"
125         },
126         {
127             option: "plugin",
128             type: "[String]",
129             description: "Specify plugins"
130         },
131         {
132             option: "rule",
133             type: "Object",
134             description: "Specify rules"
135         },
136         {
137             heading: "Fixing problems"
138         },
139         {
140             option: "fix",
141             type: "Boolean",
142             default: false,
143             description: "Automatically fix problems"
144         },
145         {
146             option: "fix-dry-run",
147             type: "Boolean",
148             default: false,
149             description: "Automatically fix problems without saving the changes to the file system"
150         },
151         {
152             option: "fix-type",
153             type: "Array",
154             description: "Specify the types of fixes to apply (problem, suggestion, layout)"
155         },
156         {
157             heading: "Ignoring files"
158         },
159         {
160             option: "ignore-path",
161             type: "path::String",
162             description: "Specify path of ignore file"
163         },
164         {
165             option: "ignore",
166             type: "Boolean",
167             default: "true",
168             description: "Disable use of ignore files and patterns"
169         },
170         {
171             option: "ignore-pattern",
172             type: "[String]",
173             description: "Pattern of files to ignore (in addition to those in .eslintignore)",
174             concatRepeatedArrays: [true, {
175                 oneValuePerFlag: true
176             }]
177         },
178         {
179             heading: "Using stdin"
180         },
181         {
182             option: "stdin",
183             type: "Boolean",
184             default: "false",
185             description: "Lint code provided on <STDIN>"
186         },
187         {
188             option: "stdin-filename",
189             type: "String",
190             description: "Specify filename to process STDIN as"
191         },
192         {
193             heading: "Handling warnings"
194         },
195         {
196             option: "quiet",
197             type: "Boolean",
198             default: "false",
199             description: "Report errors only"
200         },
201         {
202             option: "max-warnings",
203             type: "Int",
204             default: "-1",
205             description: "Number of warnings to trigger nonzero exit code"
206         },
207         {
208             heading: "Output"
209         },
210         {
211             option: "output-file",
212             alias: "o",
213             type: "path::String",
214             description: "Specify file to write report to"
215         },
216         {
217             option: "format",
218             alias: "f",
219             type: "String",
220             default: "stylish",
221             description: "Use a specific output format"
222         },
223         {
224             option: "color",
225             type: "Boolean",
226             alias: "no-color",
227             description: "Force enabling/disabling of color"
228         },
229         {
230             heading: "Inline configuration comments"
231         },
232         {
233             option: "inline-config",
234             type: "Boolean",
235             default: "true",
236             description: "Prevent comments from changing config or rules"
237         },
238         {
239             option: "report-unused-disable-directives",
240             type: "Boolean",
241             default: void 0,
242             description: "Adds reported errors for unused eslint-disable directives"
243         },
244         {
245             heading: "Caching"
246         },
247         {
248             option: "cache",
249             type: "Boolean",
250             default: "false",
251             description: "Only check changed files"
252         },
253         {
254             option: "cache-file",
255             type: "path::String",
256             default: ".eslintcache",
257             description: "Path to the cache file. Deprecated: use --cache-location"
258         },
259         {
260             option: "cache-location",
261             type: "path::String",
262             description: "Path to the cache file or directory"
263         },
264         {
265             option: "cache-strategy",
266             dependsOn: ["cache"],
267             type: "String",
268             default: "metadata",
269             enum: ["metadata", "content"],
270             description: "Strategy to use for detecting changed files in the cache"
271         },
272         {
273             heading: "Miscellaneous"
274         },
275         {
276             option: "init",
277             type: "Boolean",
278             default: "false",
279             description: "Run config initialization wizard"
280         },
281         {
282             option: "env-info",
283             type: "Boolean",
284             default: "false",
285             description: "Output execution environment information"
286         },
287         {
288             option: "error-on-unmatched-pattern",
289             type: "Boolean",
290             default: "true",
291             description: "Prevent errors when pattern is unmatched"
292         },
293         {
294             option: "exit-on-fatal-error",
295             type: "Boolean",
296             default: "false",
297             description: "Exit with exit code 2 in case of fatal error"
298         },
299         {
300             option: "debug",
301             type: "Boolean",
302             default: false,
303             description: "Output debugging information"
304         },
305         {
306             option: "help",
307             alias: "h",
308             type: "Boolean",
309             description: "Show help"
310         },
311         {
312             option: "version",
313             alias: "v",
314             type: "Boolean",
315             description: "Output the version number"
316         },
317         {
318             option: "print-config",
319             type: "path::String",
320             description: "Print the configuration for the given file"
321         }
322     ]
323 });