File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -126,8 +126,7 @@ const run = async () => {
126
126
}
127
127
128
128
if ( experimentalTags . length > 0 ) {
129
- const prefix = `${ picocolors . yellow ( 'DEPRECATION WARNING:' ) } ` ;
130
- console . warn ( `\n${ prefix } --experimental-tags is deprecated, please start using --tags instead` ) ;
129
+ logWarning ( 'DEPRECATION WARNING' , '--experimental-tags is deprecated, please start using --tags instead' ) ;
131
130
}
132
131
133
132
if ( ! noExitCode && totalErrorCount > Number ( maxIssues ) ) {
@@ -137,8 +136,7 @@ const run = async () => {
137
136
process . exitCode = 2 ;
138
137
if ( ! isDebug && error instanceof Error && isKnownError ( error ) ) {
139
138
const knownError = getKnownError ( error ) ;
140
- const prefix = `${ picocolors . red ( 'ERROR:' ) } ` ;
141
- console . error ( `${ prefix } ${ knownError . message } ` ) ;
139
+ logError ( 'ERROR' , knownError . message ) ;
142
140
if ( hasCause ( knownError ) ) console . error ( 'Reason:' , knownError . cause . message ) ;
143
141
if ( isConfigurationError ( knownError ) ) console . log ( '\nRun `knip --help` or visit https://knip.dev for help' ) ;
144
142
process . exit ( 2 ) ;
Original file line number Diff line number Diff line change
1
+ import picocolors from 'picocolors' ;
2
+
3
+ export const logWarning = ( prefix : string , message : string ) => {
4
+ console . warn ( `${ picocolors . yellow ( prefix ) } : ${ message } ` ) ;
5
+ } ;
6
+
7
+ export const logError = ( prefix : string , message : string ) => {
8
+ console . error ( `${ picocolors . red ( prefix ) } : ${ message } ` ) ;
9
+ } ;
You can’t perform that action at this time.
0 commit comments