Skip to content

Commit 880db38

Browse files
committed
removing filename requirement
1 parent e5587fb commit 880db38

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/compiler/diagnosticMessages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,11 +2068,11 @@
20682068
"category": "Error",
20692069
"code": 5056
20702070
},
2071-
"The project file name is not in 'tsconfig(-*).json' format: '{0}'": {
2071+
"Cannot find a tsconfig.json file at the specified directory: '{0}'": {
20722072
"category": "Error",
20732073
"code": 5057
20742074
},
2075-
"Cannot find any project file in specified path: '{0}'": {
2075+
"The specified path does not exist: '{0}'": {
20762076
"category": "Error",
20772077
"code": 5058
20782078
},

src/compiler/tsc.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,19 @@ namespace ts {
301301
}
302302

303303
const fileOrDirectory = normalizePath(commandLine.options.project);
304-
if (!fileOrDirectory /* current directory */ || sys.directoryExists(fileOrDirectory)) {
304+
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
305305
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
306+
if (!sys.fileExists(configFileName)) {
307+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
308+
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
309+
}
306310
}
307311
else {
308-
if (!/^tsconfig(?:-.*)?\.json$/.test(getBaseFileName(fileOrDirectory))) {
309-
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_project_file_name_is_not_in_tsconfig_Asterisk_json_format_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
312+
configFileName = fileOrDirectory;
313+
if (!sys.fileExists(configFileName)) {
314+
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
310315
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
311316
}
312-
configFileName = fileOrDirectory;
313-
}
314-
if (!sys.fileExists(configFileName)) {
315-
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_any_project_file_in_specified_path_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
316-
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
317317
}
318318
}
319319
else if (commandLine.fileNames.length === 0 && isJSONSupported()) {

0 commit comments

Comments
 (0)