UNPKG

1.09 kBPlain TextView Raw
1#!/usr/bin/env node
2
3'use strict'
4
5var yargs = require( 'yargs' )
6var stylint = require( '../' )
7
8var options = yargs
9 .usage( 'Usage: $0 [dir | file] ' )
10 .option( 'watch', {
11 alias: 'w',
12 describe: 'Watch file or directory and run lint on change',
13 type: 'boolean'
14 } )
15 .option( 'config', {
16 alias: 'c',
17 describe: 'Location of custom config file',
18 type: 'string'
19 } )
20 .option( 'strict', {
21 alias: 's',
22 describe: 'Run all tests, regardless of config',
23 type: 'boolean'
24 } )
25 .option( 'reporter', {
26 alias: 'r',
27 describe: 'Custom reporter npm module name',
28 type: 'string',
29 requiresArg: true
30 } )
31 .version( function() {
32 return 'Stylint version: ' + require( '../package' ).version
33 } )
34 .alias( 'version', 'v' )
35 .help( 'help' )
36 .alias( 'help', 'h' )
37 .alias( 'help', '?' )
38 .example( '$0 directory', 'Run Stylint on all .styl-files in "directory"' )
39 .epilogue( 'GPL-3.0 License' )
40 .argv
41
42stylint().create( {}, {
43 watch: options.watch,
44 config: options.config,
45 strict: options.strict,
46 reporter: options.reporter
47}, options._.length > 1 ? options._ : options._[0] )