Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 6505f65

Browse files
committed
Revert "Move the warning message outside of the parser function"
This reverts commit 547db22.
1 parent f11a370 commit 6505f65

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

parser.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,8 @@ const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.
1616
const ACTIVE_TYPESCRIPT_VERSION = ts.version;
1717
const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS);
1818

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-
3319
let extra;
20+
let warnedAboutTSVersion = false;
3421

3522
/**
3623
* Resets the extra config object
@@ -117,6 +104,21 @@ function parse(code, options) {
117104

118105
}
119106

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+
120122
// Even if jsx option is set in typescript compiler, filename still has to
121123
// contain .tsx file extension
122124
const FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts";

0 commit comments

Comments
 (0)