Skip to content

Commit bf425b6

Browse files
committed
feat: link to github issue for deprecated tsconfig options (#366)
1 parent 5af28bf commit bf425b6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

e2e/__snapshots__/snapshot.test.ts.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ exports[`TSGoLint E2E Snapshot Tests > should correctly evaluate project referen
77
"kind": 1,
88
"message": {
99
"description": "Invalid tsconfig",
10-
"help": "Option 'baseUrl' has been removed. Please remove it from your configuration.",
10+
"help": "Option 'baseUrl' has been removed. Please remove it from your configuration.
11+
See https://github.com/oxc-project/tsgolint/issues/351 for more information.",
1112
"id": "tsconfig-error",
1213
},
1314
"range": {
@@ -4337,7 +4338,8 @@ exports[`TSGoLint E2E Snapshot Tests > should handle tsconfig diagnostics when T
43374338
"kind": 1,
43384339
"message": {
43394340
"description": "Invalid tsconfig",
4340-
"help": "Option 'baseUrl' has been removed. Please remove it from your configuration.",
4341+
"help": "Option 'baseUrl' has been removed. Please remove it from your configuration.
4342+
See https://github.com/oxc-project/tsgolint/issues/351 for more information.",
43414343
"id": "tsconfig-error",
43424344
},
43434345
"range": {

internal/utils/create_program.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package utils
33
import (
44
"errors"
55
"fmt"
6+
"strings"
67

78
"github.com/microsoft/typescript-go/shim/bundled"
89
"github.com/microsoft/typescript-go/shim/compiler"
@@ -18,6 +19,14 @@ func CreateCompilerHost(cwd string, fs vfs.FS) compiler.CompilerHost {
1819
return compiler.NewCompilerHost(cwd, fs, defaultLibraryPath, nil, nil)
1920
}
2021

22+
func enhanceHelpDiagnosticMessage(msg string) string {
23+
if strings.Contains(msg, "Please remove it from your configuration.") {
24+
return msg + "\n" + "See https://github.com/oxc-project/tsgolint/issues/351 for more information."
25+
26+
}
27+
return msg
28+
}
29+
2130
func CreateProgram(singleThreaded bool, fs vfs.FS, cwd string, tsconfigPath string, host compiler.CompilerHost) (*compiler.Program, []diagnostic.Internal, error) {
2231
resolvedConfigPath := tspath.ResolvePath(cwd, tsconfigPath)
2332
if !fs.FileExists(resolvedConfigPath) {
@@ -93,7 +102,7 @@ func CreateProgram(singleThreaded bool, fs vfs.FS, cwd string, tsconfigPath stri
93102
Range: core.NewTextRange(loc.Pos(), loc.End()),
94103
Id: "tsconfig-error",
95104
Description: "Invalid tsconfig",
96-
Help: d.Message(),
105+
Help: enhanceHelpDiagnosticMessage(d.Message()),
97106
FilePath: &filePath,
98107
}
99108
}

0 commit comments

Comments
 (0)