Skip to content

Commit

Permalink
Only suggest that tsconfig.json is incorrect when SyntaxError is caug…
Browse files Browse the repository at this point in the history
…ht (#6160)

Co-authored-by: Ian Sutherland <ian@iansutherland.ca>
  • Loading branch information
Andarist and iansu committed Apr 4, 2019
1 parent 001c23e commit 42640df
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/react-scripts/scripts/utils/verifyTypeScriptSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,17 @@ function verifyTypeScriptSetup() {

parsedCompilerOptions = result.options;
} catch (e) {
console.error(
chalk.red.bold(
'Could not parse',
chalk.cyan('tsconfig.json') + '.',
'Please make sure it contains syntactically correct JSON.'
)
);
console.error(e && e.message ? `Details: ${e.message}` : '');
if (e && e.name === 'SyntaxError') {
console.error(
chalk.red.bold(
'Could not parse',
chalk.cyan('tsconfig.json') + '.',
'Please make sure it contains syntactically correct JSON.'
)
);
}

console.log(e && e.message ? `${e.message}` : '');
process.exit(1);
}

Expand Down

0 comments on commit 42640df

Please sign in to comment.