eslint 0.5.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +2 -8
  2. package/conf/environments.json +29 -12
  3. package/conf/eslint.json +7 -0
  4. package/lib/cli.js +21 -12
  5. package/lib/config.js +36 -13
  6. package/lib/eslint.js +218 -63
  7. package/lib/formatters/checkstyle.js +4 -6
  8. package/lib/formatters/compact.js +2 -5
  9. package/lib/formatters/junit.js +2 -5
  10. package/lib/formatters/stylish.js +2 -1
  11. package/lib/formatters/tap.js +3 -6
  12. package/lib/load-rules.js +3 -1
  13. package/lib/options.js +56 -47
  14. package/lib/rules/block-scoped-var.js +38 -4
  15. package/lib/rules/brace-style.js +6 -2
  16. package/lib/rules/default-case.js +64 -0
  17. package/lib/rules/eqeqeq.js +4 -0
  18. package/lib/rules/new-cap.js +1 -1
  19. package/lib/rules/no-comma-dangle.js +1 -1
  20. package/lib/rules/no-constant-condition.js +2 -1
  21. package/lib/rules/no-delete-var.js +1 -1
  22. package/lib/rules/no-else-return.js +1 -1
  23. package/lib/rules/no-extend-native.js +6 -2
  24. package/lib/rules/no-extra-parens.js +68 -33
  25. package/lib/rules/no-extra-strict.js +1 -1
  26. package/lib/rules/no-fallthrough.js +8 -0
  27. package/lib/rules/no-inner-declarations.js +70 -0
  28. package/lib/rules/no-invalid-regexp.js +2 -2
  29. package/lib/rules/no-lonely-if.js +28 -0
  30. package/lib/rules/no-mixed-requires.js +1 -1
  31. package/lib/rules/no-new-require.js +23 -0
  32. package/lib/rules/no-redeclare.js +4 -1
  33. package/lib/rules/no-restricted-modules.js +72 -0
  34. package/lib/rules/no-sequences.js +92 -0
  35. package/lib/rules/no-shadow-restricted-names.js +4 -2
  36. package/lib/rules/no-shadow.js +1 -1
  37. package/lib/rules/no-spaced-func.js +5 -3
  38. package/lib/rules/no-sparse-arrays.js +1 -3
  39. package/lib/rules/no-unused-vars.js +10 -4
  40. package/lib/rules/no-use-before-define.js +11 -2
  41. package/lib/rules/semi.js +11 -3
  42. package/lib/rules/sort-vars.js +1 -1
  43. package/lib/rules/space-after-keywords.js +64 -0
  44. package/lib/rules/space-infix-ops.js +11 -9
  45. package/lib/rules/space-return-throw-case.js +11 -3
  46. package/lib/rules/space-unary-word-ops.js +3 -2
  47. package/lib/rules/valid-jsdoc.js +18 -3
  48. package/package.json +8 -5
package/lib/eslint.js CHANGED
@@ -150,14 +150,78 @@ function addDeclaredGlobals(program, globalScope, config) {
150
150
  });
151
151
  }
152
152
 
153
+ /**
154
+ * Add data to reporting configuration to disable reporting for list of rules
155
+ * starting from start location
156
+ * @param {Object[]} reportingConfig Current reporting configuration
157
+ * @param {Object} start Position to start
158
+ * @param {string[]} rules List of rules
159
+ * @returns {void}
160
+ */
161
+ function disableReporting(reportingConfig, start, rules) {
162
+
163
+ if (rules.length) {
164
+ rules.forEach(function(rule){
165
+ reportingConfig.push({
166
+ start: start,
167
+ end: null,
168
+ rule: rule
169
+ });
170
+ });
171
+ } else {
172
+ reportingConfig.push({
173
+ start: start,
174
+ end: null,
175
+ rule: null
176
+ });
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Add data to reporting configuration to enable reporting for list of rules
182
+ * starting from start location
183
+ * @param {Object[]} reportingConfig Current reporting configuration
184
+ * @param {Object} start Position to start
185
+ * @param {string[]} rules List of rules
186
+ * @returns {void}
187
+ */
188
+ function enableReporting(reportingConfig, start, rules) {
189
+ if (rules.length) {
190
+ rules.forEach(function(rule){
191
+ for (var i = reportingConfig.length - 1; i >= 0; i--) {
192
+ if (!reportingConfig[i].end && reportingConfig[i].rule === rule ) {
193
+ reportingConfig[i].end = start;
194
+ break;
195
+ }
196
+ }
197
+ });
198
+ } else {
199
+ // find all previous disabled locations if they was started as list of rules
200
+ var prevStart;
201
+ for (var i = reportingConfig.length - 1; i >= 0; i--) {
202
+ if (prevStart && prevStart !== reportingConfig[i].start) {
203
+ break;
204
+ }
205
+
206
+ if (!reportingConfig[i].end) {
207
+ reportingConfig[i].end = start;
208
+ prevStart = reportingConfig[i].start;
209
+ }
210
+ }
211
+ }
212
+ }
213
+
214
+
153
215
  /**
154
216
  * Parses comments in file to extract file-specific config of rules, globals
155
- * and environments and merges them with global config.
217
+ * and environments and merges them with global config; also code blocks
218
+ * where reporting is disabled or enabled and merges them with reporting config.
156
219
  * @param {ASTNode} ast The top node of the AST.
157
220
  * @param {Object} config The existing configuration data.
158
- * @returns {Object} Merged config
221
+ * @param {Object[]} reportingConfig The existing reporting configuration data.
222
+ * @returns {void}
159
223
  */
160
- function modifyConfigFromComments(ast, config) {
224
+ function modifyConfigsFromComments(ast, config, reportingConfig) {
161
225
 
162
226
  var commentConfig = {
163
227
  globals: {},
@@ -170,7 +234,7 @@ function modifyConfigFromComments(ast, config) {
170
234
  if (comment.type === "Block") {
171
235
 
172
236
  var value = comment.value.trim();
173
- var match = /^(eslint-env|eslint|globals?)\s/.exec(value);
237
+ var match = /^(eslint-\w+|eslint|globals?)(\s|$)/.exec(value);
174
238
 
175
239
  if (match) {
176
240
  value = value.substring(match.index + match[1].length);
@@ -185,6 +249,14 @@ function modifyConfigFromComments(ast, config) {
185
249
  util.mixin(commentConfig.env, parseListConfig(value));
186
250
  break;
187
251
 
252
+ case "eslint-disable":
253
+ disableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
254
+ break;
255
+
256
+ case "eslint-enable":
257
+ enableReporting(reportingConfig, comment.loc.start, Object.keys(parseListConfig(value)));
258
+ break;
259
+
188
260
  case "eslint":
189
261
  var items = parseJsonConfig(value);
190
262
  Object.keys(items).forEach(function(name) {
@@ -210,7 +282,58 @@ function modifyConfigFromComments(ast, config) {
210
282
  });
211
283
  util.mixin(commentConfig.rules, commentRules);
212
284
 
213
- return util.mergeConfigs(config, commentConfig);
285
+ util.mergeConfigs(config, commentConfig);
286
+ }
287
+
288
+ /**
289
+ * Check if message of rule with ruleId should be ignored in location
290
+ * @param {Object[]} reportingConfig Collection of ignore records
291
+ * @param {string} ruleId Id of rule
292
+ * @param {Object} location Location of message
293
+ * @returns {boolean} True if message should be ignored, false otherwise
294
+ */
295
+ function isDisabledByReportingConfig(reportingConfig, ruleId, location) {
296
+
297
+ for (var i = 0, c = reportingConfig.length; i < c; i++) {
298
+
299
+ var ignore = reportingConfig[i];
300
+ if ((!ignore.rule || ignore.rule === ruleId) &&
301
+ (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) &&
302
+ (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) {
303
+ return true;
304
+ }
305
+ }
306
+
307
+ return false;
308
+ }
309
+
310
+ /**
311
+ * Process initial config to make it safe to extend by file comment config
312
+ * @param {Object} config Initial config
313
+ * @returns {Object} Processed config
314
+ */
315
+ function prepareConfig(config) {
316
+
317
+ config.globals = config.globals || config.global || {};
318
+ delete config.global;
319
+
320
+ var copiedRules = {};
321
+ if (typeof config.rules === "object") {
322
+ Object.keys(config.rules).forEach(function(k){
323
+ var rule = config.rules[k];
324
+ if (Array.isArray(rule)) {
325
+ copiedRules[k] = rule.slice();
326
+ } else {
327
+ copiedRules[k] = rule;
328
+ }
329
+ });
330
+ }
331
+
332
+ return {
333
+ rules: copiedRules,
334
+ globals: util.mergeConfigs({}, config.globals),
335
+ env: util.mergeConfigs({}, config.env || {})
336
+ };
214
337
  }
215
338
 
216
339
  //------------------------------------------------------------------------------
@@ -225,14 +348,15 @@ module.exports = (function() {
225
348
 
226
349
  var api = Object.create(new EventEmitter()),
227
350
  messages = [],
228
- commentsAttached = false,
229
351
  currentText = null,
230
352
  currentConfig = null,
231
353
  currentTokens = null,
232
354
  currentScopes = null,
233
355
  currentFilename = null,
234
- controller = null;
235
-
356
+ controller = null,
357
+ reportingConfig = [],
358
+ commentLocsEnter = [],
359
+ commentLocsExit = [];
236
360
 
237
361
  /**
238
362
  * Parses text into an AST. Moved out here because the try-catch prevents
@@ -250,7 +374,14 @@ module.exports = (function() {
250
374
  * problem that ESLint identified just like any other.
251
375
  */
252
376
  try {
253
- return esprima.parse(text, { loc: true, range: true, raw: true, tokens: true, comment: true });
377
+ return esprima.parse(text, {
378
+ loc: true,
379
+ range: true,
380
+ raw: true,
381
+ tokens: true,
382
+ comment: true,
383
+ attachComment: true
384
+ });
254
385
  } catch (ex) {
255
386
 
256
387
  messages.push({
@@ -267,6 +398,46 @@ module.exports = (function() {
267
398
  }
268
399
  }
269
400
 
401
+ /**
402
+ * Check collection of comments to prevent double event for comment as
403
+ * leading and trailing, then emit event if passing
404
+ * @param {ASTNode[]} comments Collection of comment nodes
405
+ * @param {Object[]} locs List of locations of previous comment nodes
406
+ * @param {string} eventName Event name postfix
407
+ * @returns {void}
408
+ */
409
+ function emitComments(comments, locs, eventName) {
410
+
411
+ if (comments.length) {
412
+ comments.forEach(function(node) {
413
+ if (locs.indexOf(node.loc) >= 0) {
414
+ locs.splice(locs.indexOf(node.loc), 1);
415
+ } else {
416
+ locs.push(node.loc);
417
+ api.emit(node.type + eventName, node);
418
+ }
419
+ });
420
+ }
421
+ }
422
+
423
+ /**
424
+ * Shortcut to check and emit enter of comment nodes
425
+ * @param {ASTNode[]} comments Collection of comment nodes
426
+ * @returns {void}
427
+ */
428
+ function emitCommentsEnter(comments) {
429
+ emitComments(comments, commentLocsEnter, "Comment");
430
+ }
431
+
432
+ /**
433
+ * Shortcut to check and emit exit of comment nodes
434
+ * @param {ASTNode[]} comments Collection of comment nodes
435
+ * @returns {void}
436
+ */
437
+ function emitCommentsExit(comments) {
438
+ emitComments(comments, commentLocsExit, "Comment:exit");
439
+ }
440
+
270
441
  // set unlimited listeners (see https://github.com/eslint/eslint/issues/524)
271
442
  api.setMaxListeners(0);
272
443
 
@@ -277,12 +448,14 @@ module.exports = (function() {
277
448
  api.reset = function() {
278
449
  this.removeAllListeners();
279
450
  messages = [];
280
- commentsAttached = false;
281
451
  currentConfig = null;
282
452
  currentText = null;
283
453
  currentTokens = null;
284
454
  currentScopes = null;
285
455
  controller = null;
456
+ reportingConfig = [];
457
+ commentLocsEnter = [];
458
+ commentLocsExit = [];
286
459
  };
287
460
 
288
461
  /**
@@ -310,12 +483,11 @@ module.exports = (function() {
310
483
 
311
484
  //if Esprima failed to parse the file, there's no sense in setting up rules
312
485
  if (ast) {
313
-
314
- config.globals = config.globals || config.global || {};
315
- delete config.global;
486
+ // process initial config to make it safe to extend
487
+ config = prepareConfig(config);
316
488
 
317
489
  // parse global comments and modify config
318
- config = modifyConfigFromComments(ast, config);
490
+ modifyConfigsFromComments(ast, config, reportingConfig);
319
491
 
320
492
  // enable appropriate rules
321
493
  Object.keys(config.rules).filter(function(key) {
@@ -383,46 +555,21 @@ module.exports = (function() {
383
555
  */
384
556
  controller.traverse(ast, {
385
557
  enter: function(node, parent) {
386
- var comments = api.getComments(node),
387
- leadingComments = comments.leading,
388
- trailingComments = comments.trailing;
389
558
 
390
- if (leadingComments.length) {
391
- leadingComments.forEach(function(node) {
392
- api.emit(node.type + "Comment", node);
393
- });
394
- }
559
+ var comments = api.getComments(node);
395
560
 
561
+ emitCommentsEnter(comments.leading);
396
562
  node.parent = parent;
397
-
398
563
  api.emit(node.type, node);
399
-
400
- if (trailingComments.length) {
401
- trailingComments.forEach(function(node) {
402
- api.emit(node.type + "Comment", node);
403
- });
404
- }
405
-
564
+ emitCommentsEnter(comments.trailing);
406
565
  },
407
566
  leave: function(node) {
408
567
 
409
- var comments = api.getComments(node),
410
- leadingComments = comments.leading,
411
- trailingComments = comments.trailing;
412
-
413
- if (trailingComments.length) {
414
- trailingComments.forEach(function(node) {
415
- api.emit(node.type + "Comment:exit", node);
416
- });
417
- }
568
+ var comments = api.getComments(node);
418
569
 
570
+ emitCommentsExit(comments.trailing);
419
571
  api.emit(node.type + ":exit", node);
420
-
421
- if (leadingComments.length) {
422
- leadingComments.forEach(function(node) {
423
- api.emit(node.type + "Comment:exit", node);
424
- });
425
- }
572
+ emitCommentsExit(comments.leading);
426
573
  }
427
574
  });
428
575
 
@@ -456,6 +603,10 @@ module.exports = (function() {
456
603
  message = message.replace(rx, opts[key]);
457
604
  });
458
605
 
606
+ if (isDisabledByReportingConfig(reportingConfig, ruleId, location)) {
607
+ return;
608
+ }
609
+
459
610
  messages.push({
460
611
  ruleId: ruleId,
461
612
  node: node,
@@ -489,17 +640,24 @@ module.exports = (function() {
489
640
  * @returns {Object} The list of comments indexed by their position.
490
641
  */
491
642
  api.getComments = function(node) {
492
- var ast = controller.root;
493
643
 
494
- if (!commentsAttached) {
495
- // Attaching comments is a potentially expensive operation, so we do this lazily.
496
- estraverse.attachComments(ast, ast.comments, ast.tokens);
497
- commentsAttached = true;
644
+ var leadingComments = node.leadingComments || [],
645
+ trailingComments = node.trailingComments || [];
646
+
647
+ /*
648
+ * Esprima adds a "comments" array on Program nodes rather than
649
+ * leadingComments/trailingComments. Comments are only left in the
650
+ * Program node comments array if there is no executable code.
651
+ */
652
+ if (node.type === "Program") {
653
+ if (node.body.length === 0) {
654
+ leadingComments = node.comments;
655
+ }
498
656
  }
499
657
 
500
658
  return {
501
- leading: node.leadingComments || [],
502
- trailing: node.trailingComments || []
659
+ leading: leadingComments,
660
+ trailing: trailingComments
503
661
  };
504
662
  };
505
663
 
@@ -538,12 +696,9 @@ module.exports = (function() {
538
696
  return null;
539
697
  }
540
698
 
541
- switch(node.type) {
699
+ switch (node.type) {
542
700
  case "FunctionDeclaration":
543
-
544
- // first global function has its comments stolen by Program
545
- var nodeToCheck = (node.leadingComments ? node : parent);
546
- return findJSDocComment(nodeToCheck.leadingComments);
701
+ return findJSDocComment(node.leadingComments);
547
702
 
548
703
  case "FunctionExpression":
549
704
 
@@ -552,7 +707,7 @@ module.exports = (function() {
552
707
  parent = parent.parent;
553
708
  }
554
709
 
555
- return parent ? findJSDocComment(parent.leadingComments) : null;
710
+ return parent && (parent.type !== "FunctionDeclaration") ? findJSDocComment(parent.leadingComments) : null;
556
711
  }
557
712
 
558
713
  // falls through
@@ -571,7 +726,7 @@ module.exports = (function() {
571
726
  api.getTokensBefore = function(node, beforeCount) {
572
727
  var beforeTokens = [], cursor = node.range[0] - 1;
573
728
  while (beforeCount > 0 && cursor >= 0) {
574
- if(currentTokens[cursor]) {
729
+ if (currentTokens[cursor]) {
575
730
  beforeTokens.unshift(currentTokens[cursor]);
576
731
  --beforeCount;
577
732
  }
@@ -607,7 +762,7 @@ module.exports = (function() {
607
762
  api.getTokensAfter = function(node, afterCount) {
608
763
  var afterTokens = [], cursor = node.range[1];
609
764
  while (afterCount > 0 && cursor < currentTokens.length) {
610
- if(currentTokens[cursor]) {
765
+ if (currentTokens[cursor]) {
611
766
  afterTokens.push(currentTokens[cursor]);
612
767
  --afterCount;
613
768
  cursor = currentTokens[cursor].range[1];
@@ -649,7 +804,7 @@ module.exports = (function() {
649
804
  tokens = [],
650
805
  cursor = node.range[0];
651
806
  while (cursor < node.range[1]) {
652
- if(currentTokens[cursor]) {
807
+ if (currentTokens[cursor]) {
653
808
  tokens.push(currentTokens[cursor]);
654
809
  cursor = currentTokens[cursor].range[1];
655
810
  } else {
@@ -668,7 +823,7 @@ module.exports = (function() {
668
823
  api.getFirstTokens = function(node, count) {
669
824
  var tokens = [], cursor = node.range[0];
670
825
  while (count > 0 && cursor < node.range[1]) {
671
- if(currentTokens[cursor]) {
826
+ if (currentTokens[cursor]) {
672
827
  tokens.push(currentTokens[cursor]);
673
828
  --count;
674
829
  cursor = currentTokens[cursor].range[1];
@@ -706,7 +861,7 @@ module.exports = (function() {
706
861
  api.getLastTokens = function(node, count) {
707
862
  var tokens = [], cursor = node.range[1] - 1;
708
863
  while (count > 0 && cursor >= node.range[0]) {
709
- if(currentTokens[cursor]) {
864
+ if (currentTokens[cursor]) {
710
865
  tokens.unshift(currentTokens[cursor]);
711
866
  --count;
712
867
  }
@@ -9,15 +9,12 @@
9
9
  //------------------------------------------------------------------------------
10
10
 
11
11
  function getMessageType(message, rules) {
12
-
13
- // TODO: Get rule severity in a better way
14
- var severity = null;
15
-
16
12
  if (message.fatal) {
17
13
  return "error";
18
14
  }
19
15
 
20
- severity = rules[message.ruleId][0] || rules[message.ruleId];
16
+ var rule = rules[message.ruleId],
17
+ severity = rule && (rule[0] || rule);
21
18
 
22
19
  if (severity === 2) {
23
20
  return "error";
@@ -28,7 +25,7 @@ function getMessageType(message, rules) {
28
25
 
29
26
  function xmlEscape(s) {
30
27
  return ("" + s).replace(/[<>&"']/g, function(c) {
31
- switch(c) {
28
+ switch (c) {
32
29
  case "<":
33
30
  return "&lt;";
34
31
  case ">":
@@ -39,6 +36,7 @@ function xmlEscape(s) {
39
36
  return "&quot;";
40
37
  case "'":
41
38
  return "&apos;";
39
+ // no default
42
40
  }
43
41
  });
44
42
  }
@@ -9,15 +9,12 @@
9
9
  //------------------------------------------------------------------------------
10
10
 
11
11
  function getMessageType(message, rules) {
12
-
13
- // TODO: Get rule severity in a better way
14
- var severity = null;
15
-
16
12
  if (message.fatal) {
17
13
  return "Error";
18
14
  }
19
15
 
20
- severity = rules[message.ruleId][0] || rules[message.ruleId];
16
+ var rule = rules[message.ruleId],
17
+ severity = rule && (rule[0] || rule);
21
18
 
22
19
  if (severity === 2) {
23
20
  return "Error";
@@ -11,15 +11,12 @@
11
11
  //------------------------------------------------------------------------------
12
12
 
13
13
  function getMessageType(message, rules) {
14
-
15
- // TODO: Get rule severity in a better way
16
- var severity = null;
17
-
18
14
  if (message.fatal) {
19
15
  return "Error";
20
16
  }
21
17
 
22
- severity = rules[message.ruleId][0] || rules[message.ruleId];
18
+ var rule = rules[message.ruleId],
19
+ severity = rule && (rule[0] || rule);
23
20
 
24
21
  if (severity === 2) {
25
22
  return "Error";
@@ -16,7 +16,8 @@ function getMessageType(message, rules) {
16
16
  return chalk.red("error");
17
17
  }
18
18
 
19
- var severity = rules[message.ruleId][0] || rules[message.ruleId];
19
+ var rule = rules[message.ruleId],
20
+ severity = rule && (rule[0] || rule);
20
21
 
21
22
  if (severity === 2) {
22
23
  return chalk.red("error");
@@ -20,15 +20,12 @@ var yaml = require("js-yaml");
20
20
  * @returns {String} Error level string
21
21
  */
22
22
  function getMessageType(message, rules) {
23
-
24
- // TODO: Get rule severity in a better way
25
- var severity = null;
26
-
27
23
  if (message.fatal) {
28
24
  return "error";
29
25
  }
30
26
 
31
- severity = rules[message.ruleId][0] || rules[message.ruleId];
27
+ var rule = rules[message.ruleId],
28
+ severity = rule && (rule[0] || rule);
32
29
 
33
30
  if (severity === 2) {
34
31
  return "error";
@@ -94,7 +91,7 @@ module.exports = function(results, config) {
94
91
 
95
92
  output += testResult + " " + (id + 1) + " - " + result.filePath + "\n";
96
93
 
97
- // If we have an error include diagnostics
94
+ // If we have an error include diagnostics
98
95
  if (messages.length > 0) {
99
96
  output += outputDiagnostics(diagnostics);
100
97
  }
package/lib/load-rules.js CHANGED
@@ -30,7 +30,9 @@ module.exports = function(rulesDir) {
30
30
 
31
31
  var rules = Object.create(null);
32
32
  fs.readdirSync(rulesDir).forEach(function(file) {
33
- if (path.extname(file) !== ".js") { return; }
33
+ if (path.extname(file) !== ".js") {
34
+ return;
35
+ }
34
36
  rules[file.slice(0, -3)] = require(path.join(rulesDir, file));
35
37
  });
36
38
  return rules;
package/lib/options.js CHANGED
@@ -16,51 +16,60 @@ var optionator = require("optionator");
16
16
 
17
17
  // exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
18
18
  module.exports = optionator({
19
- prepend: "eslint [options] file.js [file.js] [dir]",
20
- concatRepeatedArrays: true,
21
- options: [{
22
- heading: "Options"
23
- }, {
24
- option: "help",
25
- alias: "h",
26
- type: "Boolean",
27
- description: "Show help."
28
- }, {
29
- option: "config",
30
- alias: "c",
31
- type: "path::String",
32
- description: "Load configuration data from this file."
33
- }, {
34
- option: "rulesdir",
35
- type: "path::String",
36
- description: "Load additional rules from this directory."
37
- }, {
38
- option: "format",
39
- alias: "f",
40
- type: "String",
41
- default: "stylish",
42
- description: "Use a specific output format."
43
- }, {
44
- option: "version",
45
- alias: "v",
46
- type: "Boolean",
47
- description: "Outputs the version number."
48
- }, {
49
- option: "reset",
50
- type: "Boolean",
51
- description: "Set all default rules to off."
52
- }, {
53
- option: "eslintrc",
54
- type: "Boolean",
55
- default: "true",
56
- description: "Enable loading .eslintrc configuration."
57
- }, {
58
- option: "env",
59
- type: "[String]",
60
- description: "Specify environments."
61
- }, {
62
- option: "global",
63
- type: "[String]",
64
- description: "Define global variables."
65
- }]
19
+ prepend: "eslint [options] file.js [file.js] [dir]",
20
+ concatRepeatedArrays: true,
21
+ mergeRepeatedObjects: true,
22
+ options: [{
23
+ heading: "Options"
24
+ }, {
25
+ option: "help",
26
+ alias: "h",
27
+ type: "Boolean",
28
+ description: "Show help."
29
+ }, {
30
+ option: "config",
31
+ alias: "c",
32
+ type: "path::String",
33
+ description: "Load configuration data from this file."
34
+ }, {
35
+ option: "rulesdir",
36
+ type: "[path::String]",
37
+ description: "Load additional rules from this directory."
38
+ }, {
39
+ option: "format",
40
+ alias: "f",
41
+ type: "String",
42
+ default: "stylish",
43
+ description: "Use a specific output format."
44
+ }, {
45
+ option: "version",
46
+ alias: "v",
47
+ type: "Boolean",
48
+ description: "Outputs the version number."
49
+ }, {
50
+ option: "reset",
51
+ type: "Boolean",
52
+ description: "Set all default rules to off."
53
+ }, {
54
+ option: "eslintrc",
55
+ type: "Boolean",
56
+ default: "true",
57
+ description: "Enable loading .eslintrc configuration."
58
+ }, {
59
+ option: "env",
60
+ type: "[String]",
61
+ description: "Specify environments."
62
+ }, {
63
+ option: "force",
64
+ type: "Boolean",
65
+ description: "Allow linting of otherwise ignored files."
66
+ }, {
67
+ option: "global",
68
+ type: "[String]",
69
+ description: "Define global variables."
70
+ },{
71
+ option: "rule",
72
+ type: "Object",
73
+ description: "Specify rules."
74
+ }]
66
75
  });