@@ -28,8 +28,8 @@ function displayHelp() {
2828 ' Path to configuration file.' ,
2929 ' -d, --detect' ,
3030 ' Run the tool in detect mode, returning detected options.' ,
31- ' -l , --lint ' ,
32- ' Run the tool in linter mode, without modifying files.' ,
31+ ' -f , --fix ' ,
32+ ' Run the tool in fixer mode, modifying files when possible .' ,
3333 ' -v, --verbose' ,
3434 ' Whether to print logging info.'
3535 ] ;
@@ -49,7 +49,7 @@ var getInputData = new vow.Promise(function(resolve) {
4949} ) ;
5050
5151function processInputData ( input ) {
52- comb . processString ( input ) . catch ( e => {
52+ comb . lintString ( input ) . catch ( e => {
5353 process . stderr . write ( e . message ) ;
5454 process . exit ( 1 ) ;
5555 } ) . then ( output => {
@@ -63,33 +63,16 @@ function processSTDIN() {
6363}
6464
6565function processFiles ( files , config ) {
66- vow . all ( files . map ( comb . processPath . bind ( comb ) ) ) . then ( function ( c ) {
67- c = c . filter ( function ( isChanged ) {
68- return isChanged !== undefined ;
69- } ) ;
70-
71- var tbchanged = c . reduce ( function ( a , b ) {
72- return a + b ;
73- } , 0 ) ;
74-
75- var changed = config . lint ? 0 : tbchanged ;
76-
77- if ( config . verbose ) {
78- let message = `\n
79- ${ c . length } file${ c . length === 1 ? '' : 's' } processed\n
80- ${ changed } file${ changed === 1 ? '' : 's' } fixed\n` ;
81- process . stdout . write ( format ( message ) ) ;
82- console . timeEnd ( 'Time spent' ) ;
83- }
84-
85- if ( config . lint && tbchanged ) {
86- process . exit ( 1 ) ;
87- }
66+ const promises = files . map ( file => {
67+ return comb . lintPath ( file ) ;
68+ } ) ;
8869
89- process . exit ( 0 ) ;
90- } ) . fail ( function ( e ) {
91- process . stderr . write ( e . stack ) ;
70+ Promise . all ( promises ) . catch ( error => {
71+ process . stderr . write ( error . message ) ;
9272 process . exit ( 1 ) ;
73+ } ) . then ( function ( c ) {
74+ console . log ( c ) ;
75+ process . exit ( 0 ) ;
9376 } ) ;
9477}
9578
@@ -146,7 +129,6 @@ function getConfig(options) {
146129
147130 applyTemplate ( config ) ;
148131 if ( options . verbose ) config . verbose = options . verbose ;
149- if ( options . lint ) config . lint = options . lint ;
150132
151133 return config ;
152134}
0 commit comments