Fix #11650 add an error message for no source files parsing a tsconfig.json (#11743)

* Fix #11650 add an error message for no source files parsing a tsconfig.json

* Use the file name in error message

* Use constants

* Review comments: change message text
This commit is contained in:
Mohamed Hegazy
2016-10-24 11:00:32 -07:00
committed by GitHub
parent a8db81393f
commit 4dc6028263
4 changed files with 148 additions and 25 deletions

View File

@@ -912,6 +912,9 @@ namespace ts {
if (hasProperty(json, "files")) {
if (isArray(json["files"])) {
fileNames = <string[]>json["files"];
if (fileNames.length === 0) {
errors.push(createCompilerDiagnostic(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"));
}
}
else {
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"));
@@ -954,7 +957,18 @@ namespace ts {
includeSpecs = ["**/*"];
}
return matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
if (result.fileNames.length === 0 && !hasProperty(json, "files") && resolutionStack.length === 0) {
errors.push(
createCompilerDiagnostic(
Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2,
configFileName || "tsconfig.json",
JSON.stringify(includeSpecs || []),
JSON.stringify(excludeSpecs || [])));
}
return result;
}
}