UNPKG

1.96 kBPlain TextView Raw
1#!/usr/bin/env node
2var cli = require('../lib/get-cli');
3
4/**
5 * Command line implementation for JSCS.
6 *
7 * Common usage case is:
8 *
9 * ./node_modules/.bin/jscs file1 dir1 file2 dir2
10 */
11var program = require('commander');
12
13program
14 .version(require('../package.json').version)
15 .usage('[options] <file ...>')
16 .description('A code style linter for programmatically enforcing your style guide.')
17 .option('-c, --config [path]', 'configuration file path')
18 .option('--auto-configure <path> [paths]', 'auto-generate a JSCS configuration file')
19 .option('-x, --fix', 'fix code style violations (applies to fixable violations)')
20 .option('--extract <mask>', 'set file masks from which to extract JavaScript', function(value, memo) {
21 return memo ? memo.concat(value) : [value];
22 })
23 .option('-e, --esnext', 'attempts to parse esnext code (currently es6)')
24 .option('--es3', 'validates code as es3')
25 .option('-s, --esprima <path>', 'attempts to use a custom version of Esprima')
26 .option('-n, --no-colors', 'clean output without colors')
27 .option('-p, --preset <preset>', 'preset config')
28 .option('-v, --verbose', 'adds rule names to the error output')
29 .option('-m, --max-errors <number>', 'maximum number of errors to report')
30 .option('-f, --error-filter <path>', 'a module to filter errors')
31 .option('-r, --reporter <reporter>',
32 'error reporter, console - default, text, checkstyle, junit, inline, unix, summary, json')
33 .option('', 'Also accepts relative or absolute path to custom reporter')
34 .option('', 'For instance:')
35 .option('', '\t ../some-dir/my-reporter.js\t(relative path with extension)')
36 .option('', '\t ../some-dir/my-reporter\t(relative path without extension)')
37 .option('', '\t /path/to/my-reporter.js\t(absolute path with extension)')
38 .option('', '\t /path/to/my-reporter\t\t(absolute path without extension)')
39 .parse(process.argv);
40
41cli(program);