Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/diagnostics/diagnostics_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/diagnostics/extraDiagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"category": "Error",
"code": 5090
},
"A project reference path cannot be an empty string. Did you mean '.'?": {
"category": "Error",
"code": 18052
},
"A JSDoc '@type' tag on a function must have a signature with the correct number of arguments.": {
"category": "Error",
"code": 8030
Expand Down
2 changes: 1 addition & 1 deletion internal/tsoptions/tsconfigparsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ func parseJsonConfigFileContentWorker(
continue
}
if ref.reference.Path == "" {
errors = append(errors, createDiagnosticAtProjectReferenceProperty(sourceFile, index, "path", diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "reference.path"))
errors = append(errors, createDiagnosticAtProjectReferenceProperty(sourceFile, index, "path", diagnostics.A_project_reference_path_cannot_be_an_empty_string_Did_you_mean))
continue
}
if ref.hasCircular && !ref.circularValid {
Expand Down
13 changes: 13 additions & 0 deletions internal/tsoptions/tsconfigparsing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,19 @@ var parseJsonConfigFileTests = []parseJsonConfigTestCase{
allFileList: map[string]string{"/apath/a.ts": ""},
}},
},
{
title: "generates errors for empty reference path",
noSubmoduleBaseline: true,
input: []testConfig{{
jsonText: `{
"references": [{ "path": "" }],
"files": ["a.ts"]
}`,
configFileName: "/apath/tsconfig.json",
basePath: "/apath",
allFileList: map[string]string{"/apath/a.ts": ""},
}},
},
{
title: "exclude outDir unless overridden",
input: []testConfig{{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Fs::
//// [/apath/a.ts]


//// [/apath/tsconfig.json]
{
"references": [{ "path": "" }],
"files": ["a.ts"]
}


configFileName:: /apath/tsconfig.json
CompilerOptions::
{
"configFilePath": "/apath/tsconfig.json"
}

TypeAcquisition::
{}

FileNames::
/apath/a.ts
Errors::
error TS18052: A project reference path cannot be an empty string. Did you mean '.'?
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Fs::
//// [/apath/a.ts]


//// [/apath/tsconfig.json]
{
"references": [{ "path": "" }],
"files": ["a.ts"]
}


configFileName:: /apath/tsconfig.json
CompilerOptions::
{
"configFilePath": "/apath/tsconfig.json"
}

TypeAcquisition::
{}

FileNames::
/apath/a.ts
Errors::
tsconfig.json:2:42 - error TS18052: A project reference path cannot be an empty string. Did you mean '.'?

2 "references": [{ "path": "" }],
   ~~

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Output::
9 { "path": "./utils", "circular": "yes" },
   ~~~~~

tsconfig.json:10:19 - error TS18051: Compiler option 'reference.path' cannot be given an empty string.
tsconfig.json:10:19 - error TS18052: A project reference path cannot be an empty string. Did you mean '.'?

10 { "path": "" },
   ~~
Expand Down