@@ -23,23 +23,31 @@ const isRunningSupportedTypeScriptVersion = semver.satisfies(
2323
2424let warnedAboutTSVersion = false ;
2525
26- export function warnAboutTSVersion ( parseSettings : ParseSettings ) : void {
27- if ( ! isRunningSupportedTypeScriptVersion && ! warnedAboutTSVersion ) {
28- const isTTY =
29- typeof process === 'undefined' ? false : process . stdout ?. isTTY ;
30- if ( isTTY ) {
31- const border = '=============' ;
32- const versionWarning = [
33- border ,
34- 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.' ,
35- 'You may find that it works just fine, or you may not.' ,
36- `SUPPORTED TYPESCRIPT VERSIONS: ${ SUPPORTED_TYPESCRIPT_VERSIONS } ` ,
37- `YOUR TYPESCRIPT VERSION: ${ ACTIVE_TYPESCRIPT_VERSION } ` ,
38- 'Please only submit bug reports when using the officially supported version.' ,
39- border ,
40- ] ;
41- parseSettings . log ( versionWarning . join ( '\n\n' ) ) ;
42- }
43- warnedAboutTSVersion = true ;
26+ export function warnAboutTSVersion (
27+ parseSettings : ParseSettings ,
28+ passedLoggerFn : boolean ,
29+ ) : void {
30+ if ( isRunningSupportedTypeScriptVersion || warnedAboutTSVersion ) {
31+ return ;
4432 }
33+
34+ if (
35+ passedLoggerFn ||
36+ ( typeof process === 'undefined' ? false : process . stdout ?. isTTY )
37+ ) {
38+ const border = '=============' ;
39+ const versionWarning = [
40+ border ,
41+ 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.' ,
42+ 'You may find that it works just fine, or you may not.' ,
43+ `SUPPORTED TYPESCRIPT VERSIONS: ${ SUPPORTED_TYPESCRIPT_VERSIONS } ` ,
44+ `YOUR TYPESCRIPT VERSION: ${ ACTIVE_TYPESCRIPT_VERSION } ` ,
45+ 'Please only submit bug reports when using the officially supported version.' ,
46+ border ,
47+ ] . join ( '\n\n' ) ;
48+
49+ parseSettings . log ( versionWarning ) ;
50+ }
51+
52+ warnedAboutTSVersion = true ;
4553}
0 commit comments