show an error if --showConfig is enabled and tsconfig.json does not exist (#35723)

This commit is contained in:
Alexander T 2019-12-23 22:30:21 +02:00 committed by Daniel Rosenwasser
parent a39a675696
commit 320adf5ce0
2 changed files with 13 additions and 3 deletions

View File

@ -3329,6 +3329,10 @@
"category": "Error",
"code": 5080
},
"Cannot find a tsconfig.json file at the current directory: {0}.": {
"category": "Error",
"code": 5081
},
"Generates a sourcemap for each corresponding '.d.ts' file.": {
"category": "Message",

View File

@ -241,9 +241,15 @@ namespace ts {
}
if (commandLine.fileNames.length === 0 && !configFileName) {
printVersion(sys);
printHelp(sys, getOptionsForHelp(commandLine));
return sys.exit(ExitStatus.Success);
if (commandLine.options.showConfig) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys.getCurrentDirectory())));
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
else {
printVersion(sys);
printHelp(sys, getOptionsForHelp(commandLine));
return sys.exit(ExitStatus.Success);
}
}
const currentDirectory = sys.getCurrentDirectory();