@@ -16,21 +16,8 @@ const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.
16
16
const ACTIVE_TYPESCRIPT_VERSION = ts . version ;
17
17
const isRunningSupportedTypeScriptVersion = semver . satisfies ( ACTIVE_TYPESCRIPT_VERSION , SUPPORTED_TYPESCRIPT_VERSIONS ) ;
18
18
19
- if ( ! isRunningSupportedTypeScriptVersion ) {
20
- const border = "=============" ;
21
- const versionWarning = [
22
- border ,
23
- "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser." ,
24
- "You may find that it works just fine, or you may not." ,
25
- `SUPPORTED TYPESCRIPT VERSIONS: ${ SUPPORTED_TYPESCRIPT_VERSIONS } ` ,
26
- `YOUR TYPESCRIPT VERSION: ${ ACTIVE_TYPESCRIPT_VERSION } ` ,
27
- "Please only submit bug reports when using the officially supported version." ,
28
- border
29
- ] ;
30
- console . log ( versionWarning . join ( "\n\n" ) ) ; // eslint-disable-line no-console
31
- }
32
-
33
19
let extra ;
20
+ let warnedAboutTSVersion = false ;
34
21
35
22
/**
36
23
* Resets the extra config object
@@ -117,6 +104,21 @@ function parse(code, options) {
117
104
118
105
}
119
106
107
+ if ( ! isRunningSupportedTypeScriptVersion && ! warnedAboutTSVersion ) {
108
+ const border = "=============" ;
109
+ const versionWarning = [
110
+ border ,
111
+ "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser." ,
112
+ "You may find that it works just fine, or you may not." ,
113
+ `SUPPORTED TYPESCRIPT VERSIONS: ${ SUPPORTED_TYPESCRIPT_VERSIONS } ` ,
114
+ `YOUR TYPESCRIPT VERSION: ${ ACTIVE_TYPESCRIPT_VERSION } ` ,
115
+ "Please only submit bug reports when using the officially supported version." ,
116
+ border
117
+ ] ;
118
+ extra . log ( versionWarning . join ( "\n\n" ) ) ;
119
+ warnedAboutTSVersion = true ;
120
+ }
121
+
120
122
// Even if jsx option is set in typescript compiler, filename still has to
121
123
// contain .tsx file extension
122
124
const FILENAME = ( extra . ecmaFeatures . jsx ) ? "eslint.tsx" : "eslint.ts" ;
0 commit comments