Skip to content

Commit 42640df

Browse files
Andaristiansu
andcommitted
Only suggest that tsconfig.json is incorrect when SyntaxError is caught (#6160)
Co-authored-by: Ian Sutherland <[email protected]>
1 parent 001c23e commit 42640df

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,17 @@ function verifyTypeScriptSetup() {
175175

176176
parsedCompilerOptions = result.options;
177177
} catch (e) {
178-
console.error(
179-
chalk.red.bold(
180-
'Could not parse',
181-
chalk.cyan('tsconfig.json') + '.',
182-
'Please make sure it contains syntactically correct JSON.'
183-
)
184-
);
185-
console.error(e && e.message ? `Details: ${e.message}` : '');
178+
if (e && e.name === 'SyntaxError') {
179+
console.error(
180+
chalk.red.bold(
181+
'Could not parse',
182+
chalk.cyan('tsconfig.json') + '.',
183+
'Please make sure it contains syntactically correct JSON.'
184+
)
185+
);
186+
}
187+
188+
console.log(e && e.message ? `${e.message}` : '');
186189
process.exit(1);
187190
}
188191

0 commit comments

Comments
 (0)