Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

options.js 11KB

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