From 271003008edb8c68d365db95713e824e611cd85f Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 22 Sep 2015 17:53:20 +0900 Subject: [PATCH] format/existence check --- src/compiler/diagnosticMessages.json | 18 +++++++++++++----- src/compiler/tsc.ts | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c1657a81bab..1f187494639 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1623,7 +1623,7 @@ }, "Cannot assign an abstract constructor type to a non-abstract constructor type.": { "category": "Error", - "code":2517 + "code": 2517 }, "Only an ambient class can be merged with an interface.": { "category": "Error", @@ -1700,11 +1700,11 @@ "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead.": { "category": "Error", "code": 2652 - }, + }, "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'.": { "category": "Error", "code": 2653 - }, + }, "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.": { "category": "Error", "code": 2654 @@ -1712,11 +1712,11 @@ "Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": { "category": "Error", "code": 2655 - }, + }, "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": { "category": "Error", "code": 2656 - }, + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 @@ -2057,6 +2057,14 @@ "category": "Error", "code": 5053 }, + "The project file name is not in 'tsconfig-*.json' format: '{0}'": { + "category": "Error", + "code": 5055 + }, + "Cannot find any project file in specified path: '{0}'": { + "category": "Error", + "code": 5056 + }, "Concatenate and emit output to single file.": { "category": "Message", diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 25e149cf6ca..3aedd5efd11 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -190,8 +190,16 @@ namespace ts { configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); } else { + if (!/^tsconfig.*\.json$/.test(getBaseFileName(fileOrDirectory))) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_project_file_name_is_not_in_tsconfig_Asterisk_json_format_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } configFileName = fileOrDirectory; } + if (!sys.fileExists(configFileName)) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_any_project_file_in_specified_path_Colon_0, commandLine.options.project)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); + } } else if (commandLine.fileNames.length === 0 && isJSONSupported()) { let searchPath = normalizePath(sys.getCurrentDirectory());