UNPKG

6.21 kBJavaScriptView Raw
1/**
2 * @fileoverview Options configuration for optionator.
3 * @author George Zahariev
4 */
5
6"use strict";
7
8//------------------------------------------------------------------------------
9// Requirements
10//------------------------------------------------------------------------------
11
12const optionator = require("optionator");
13
14//------------------------------------------------------------------------------
15// Initialization and Public Interface
16//------------------------------------------------------------------------------
17
18// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
19module.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: "config",
31 alias: "c",
32 type: "path::String",
33 description: "Use configuration from this file or shareable config"
34 },
35 {
36 option: "eslintrc",
37 type: "Boolean",
38 default: "true",
39 description: "Disable use of configuration from .eslintrc"
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: "Caching"
69 },
70 {
71 option: "cache",
72 type: "Boolean",
73 default: "false",
74 description: "Only check changed files"
75 },
76 {
77 option: "cache-file",
78 type: "path::String",
79 default: ".eslintcache",
80 description: "Path to the cache file. Deprecated: use --cache-location"
81 },
82 {
83 option: "cache-location",
84 type: "path::String",
85 description: "Path to the cache file or directory"
86 },
87 {
88 heading: "Specifying rules and plugins"
89 },
90 {
91 option: "rulesdir",
92 type: "[path::String]",
93 description: "Use additional rules from this directory"
94 },
95 {
96 option: "plugin",
97 type: "[String]",
98 description: "Specify plugins"
99 },
100 {
101 option: "rule",
102 type: "Object",
103 description: "Specify rules"
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: "Miscellaneous"
180 },
181 {
182 option: "init",
183 type: "Boolean",
184 default: "false",
185 description: "Run config initialization wizard"
186 },
187 {
188 option: "fix",
189 type: "Boolean",
190 default: false,
191 description: "Automatically fix problems"
192 },
193 {
194 option: "debug",
195 type: "Boolean",
196 default: false,
197 description: "Output debugging information"
198 },
199 {
200 option: "help",
201 alias: "h",
202 type: "Boolean",
203 description: "Show help"
204 },
205 {
206 option: "version",
207 alias: "v",
208 type: "Boolean",
209 description: "Output the version number"
210 },
211 {
212 option: "inline-config",
213 type: "Boolean",
214 default: "true",
215 description: "Prevent comments from changing config or rules"
216 },
217 {
218 option: "print-config",
219 type: "Boolean",
220 description: "Print the configuration to be used"
221 }
222 ]
223});