File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,20 @@ const fixingCommands = {
1616} ;
1717
1818const command = process . argv . slice ( 2 ) ;
19+ const currentScriptName = process . env . npm_lifecycle_event ;
20+
21+ // Redirect the main lint command, but not individual commands.
22+ if ( currentScriptName === 'lint' && command . includes ( '--fix' ) ) {
23+ console . log ( `🔧 Detected --fix flag, running: yarn lint-fix` ) ;
24+ const result = cp . spawnSync ( 'yarn' , [ 'lint-fix' ] , { stdio : 'inherit' } ) ;
25+ process . exitCode = result . status ;
26+ process . exit ( ) ;
27+ }
1928
2029const result = cp . spawnSync ( command [ 0 ] , command . slice ( 1 ) , { stdio : 'inherit' } ) ;
2130
2231if ( result . status !== 0 ) {
2332 process . exitCode = result . status ;
24- const currentScriptName = process . env . npm_lifecycle_event ;
2533 if ( currentScriptName && currentScriptName in fixingCommands ) {
2634 console . log (
2735 '💡 You might be able to fix the error by running `yarn ' +
You can’t perform that action at this time.
0 commit comments