Skip to content

Commit d15eff1

Browse files
chore(deps): update typescript-go digest to 746dcca (#455)
This PR contains the following updates: | Package | Update | Change | |---|---|---| | typescript-go | digest | `733dc6a` -> `746dcca` | --- ### Configuration 📅 **Schedule**: Branch creation - "before 9am" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/tsgolint). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xNi4xIiwidXBkYXRlZEluVmVyIjoiNDIuMTYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Cameron Clark <[email protected]>
1 parent 017409f commit d15eff1

19 files changed

+86
-54
lines changed

internal/linter/linter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func RunLinterOnProgram(logLevel utils.LogLevel, program *compiler.Program, file
176176
onInternalDiagnostic(diagnostic.Internal{
177177
Range: d.Loc(),
178178
Id: "TS" + strconv.Itoa(int(d.Code())),
179-
Description: d.Message(),
179+
Description: utils.GetDiagnosticMessage(d),
180180
FilePath: &fileName,
181181
})
182182
}
@@ -190,7 +190,7 @@ func RunLinterOnProgram(logLevel utils.LogLevel, program *compiler.Program, file
190190
onInternalDiagnostic(diagnostic.Internal{
191191
Range: d.Loc(),
192192
Id: "TS" + strconv.Itoa(int(d.Code())),
193-
Description: d.Message(),
193+
Description: utils.GetDiagnosticMessage(d),
194194
FilePath: &fileName,
195195
})
196196
}

internal/utils/create_program.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func CreateProgram(singleThreaded bool, fs vfs.FS, cwd string, tsconfigPath stri
4747
Range: core.NewTextRange(loc.Pos(), loc.End()),
4848
Id: "tsconfig-error",
4949
Description: "Invalid tsconfig",
50-
Help: d.Message(),
50+
Help: GetDiagnosticMessage(d),
5151
FilePath: &filePath,
5252
}
5353
}
@@ -66,7 +66,7 @@ func CreateProgram(singleThreaded bool, fs vfs.FS, cwd string, tsconfigPath stri
6666
Range: core.NewTextRange(loc.Pos(), loc.End()),
6767
Id: "tsconfig-error",
6868
Description: "Invalid tsconfig",
69-
Help: e.Message(),
69+
Help: GetDiagnosticMessage(e),
7070
FilePath: &filePath,
7171
}
7272
}
@@ -102,7 +102,7 @@ func CreateProgram(singleThreaded bool, fs vfs.FS, cwd string, tsconfigPath stri
102102
Range: core.NewTextRange(loc.Pos(), loc.End()),
103103
Id: "tsconfig-error",
104104
Description: "Invalid tsconfig",
105-
Help: enhanceHelpDiagnosticMessage(d.Message()),
105+
Help: enhanceHelpDiagnosticMessage(GetDiagnosticMessage(d)),
106106
FilePath: &filePath,
107107
}
108108
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package utils
2+
3+
import (
4+
"github.com/microsoft/typescript-go/shim/ast"
5+
)
6+
7+
// GetDiagnosticMessage returns the localized message for a diagnostic using the default locale (English).
8+
func GetDiagnosticMessage(d *ast.Diagnostic) string {
9+
// Use the Localize method with the default locale
10+
// locale.Default is accessed via the shim's linkname helper
11+
return ast.Diagnostic_Localize(d, ast.DefaultLocale())
12+
}

internal/utils/host.go

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package utils
22

33
import (
44
"github.com/microsoft/typescript-go/shim/ast"
5+
"github.com/microsoft/typescript-go/shim/compiler"
56
"github.com/microsoft/typescript-go/shim/core"
67

78
"github.com/microsoft/typescript-go/shim/parser"
@@ -12,32 +13,23 @@ import (
1213
"github.com/typescript-eslint/tsgolint/internal/collections"
1314
)
1415

15-
type CompilerHost interface {
16-
FS() vfs.FS
17-
DefaultLibraryPath() string
18-
GetCurrentDirectory() string
19-
Trace(msg string)
20-
GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile
21-
GetResolvedProjectReference(fileName string, path tspath.Path) *tsoptions.ParsedCommandLine
22-
}
23-
24-
var _ CompilerHost = (*compilerHost)(nil)
16+
var _ compiler.CompilerHost = (*compilerHost)(nil)
2517

2618
type compilerHost struct {
2719
currentDirectory string
2820
fs vfs.FS
2921
defaultLibraryPath string
3022
extendedConfigCache tsoptions.ExtendedConfigCache
31-
trace func(msg string)
23+
trace func(msg *ast.DiagnosticsMessage, args ...any)
3224
}
3325

3426
func NewCachedFSCompilerHost(
3527
currentDirectory string,
3628
fs vfs.FS,
3729
defaultLibraryPath string,
3830
extendedConfigCache tsoptions.ExtendedConfigCache,
39-
trace func(msg string),
40-
) CompilerHost {
31+
trace func(msg *ast.DiagnosticsMessage, args ...any),
32+
) compiler.CompilerHost {
4133
return NewCompilerHost(currentDirectory, cachedvfs.From(fs), defaultLibraryPath, extendedConfigCache, trace)
4234
}
4335

@@ -46,10 +38,10 @@ func NewCompilerHost(
4638
fs vfs.FS,
4739
defaultLibraryPath string,
4840
extendedConfigCache tsoptions.ExtendedConfigCache,
49-
trace func(msg string),
50-
) CompilerHost {
41+
trace func(msg *ast.DiagnosticsMessage, args ...any),
42+
) compiler.CompilerHost {
5143
if trace == nil {
52-
trace = func(msg string) {}
44+
trace = func(msg *ast.DiagnosticsMessage, args ...any) {}
5345
}
5446
return &compilerHost{
5547
currentDirectory: currentDirectory,
@@ -72,8 +64,8 @@ func (h *compilerHost) GetCurrentDirectory() string {
7264
return h.currentDirectory
7365
}
7466

75-
func (h *compilerHost) Trace(msg string) {
76-
h.trace(msg)
67+
func (h *compilerHost) Trace(msg *ast.DiagnosticsMessage, args ...any) {
68+
h.trace(msg, args...)
7769
}
7870

7971
var sourceFileCache collections.SyncMap[SourceFileCacheKey, *ast.SourceFile]

patches/0001-Parallel-readDirectory-visitor.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From b2d2f77a37c40f81b2d9e94ae9a1964de801a9c1 Mon Sep 17 00:00:00 2001
1+
From 48b7be2302cc6347dd9d443eec2a011be7604918 Mon Sep 17 00:00:00 2001
22
From: auvred <[email protected]>
33
Date: Wed, 18 Jun 2025 15:24:34 +0300
44
Subject: [PATCH] Parallel readDirectory visitor

patches/0002-Adapt-project-service-for-single-run-mode.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 06440d61f08f69b79322a3f076ebd25c90c81f9e Mon Sep 17 00:00:00 2001
1+
From cc83938254088bdcc75f9d481d233ee49d183519 Mon Sep 17 00:00:00 2001
22
From: Cameron Clark <[email protected]>
33
Date: Fri, 14 Nov 2025 11:09:52 +0000
44
Subject: [PATCH] Adapt project service for single run mode

patches/0003-perf-tspath-use-unsafe.String-to-avoid-allocations-w.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
From e3256fff5af97e08c0b8ebfcddf382d99d1323eb Mon Sep 17 00:00:00 2001
1+
From 23357cd285292d27cf900dbe6f2a7a5dbe5aa5c6 Mon Sep 17 00:00:00 2001
22
From: Cameron Clark <[email protected]>
33
Date: Fri, 15 Aug 2025 16:06:42 +0100
4-
Subject: [PATCH] perf(tspath): use `unsafe.String` to avoid allocations when
5-
lower casing string
4+
Subject: [PATCH] perf(tspath): use `unsafe.String` to avoid allocations
5+
when lower casing string
66

77
---
88
internal/tspath/path.go | 13 ++++++++++++-

patches/0004-patch-expose-more-functions-via-the-shim-with-type-f.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 902813a492fd948635177320b257d2d5d1a7352d Mon Sep 17 00:00:00 2001
1+
From 9aa648bb87eb8485be34b6dfc9f2ad12d5ce9ff2 Mon Sep 17 00:00:00 2001
22
From: Cameron Clark <[email protected]>
33
Date: Sat, 22 Nov 2025 11:01:42 +0000
44
Subject: [PATCH] patch: expose more functions via the shim with type fixes
@@ -13,10 +13,10 @@ Subject: [PATCH] patch: expose more functions via the shim with type fixes
1313
6 files changed, 116 insertions(+), 107 deletions(-)
1414

1515
diff --git a/internal/project/compilerhost.go b/internal/project/compilerhost.go
16-
index c6293c701..7eb7100f2 100644
16+
index 30fa7a72b..a670b2d8f 100644
1717
--- a/internal/project/compilerhost.go
1818
+++ b/internal/project/compilerhost.go
19-
@@ -19,7 +19,7 @@ type compilerHost struct {
19+
@@ -20,7 +20,7 @@ type compilerHost struct {
2020
currentDirectory string
2121
sessionOptions *SessionOptions
2222

@@ -25,7 +25,7 @@ index c6293c701..7eb7100f2 100644
2525
compilerFS *compilerFS
2626
configFileRegistry *ConfigFileRegistry
2727
seenFiles *collections.SyncSet[tspath.Path]
28-
@@ -31,7 +31,7 @@ type compilerHost struct {
28+
@@ -32,7 +32,7 @@ type compilerHost struct {
2929

3030
type builderFileSource struct {
3131
seenFiles *collections.SyncSet[tspath.Path]
@@ -34,7 +34,7 @@ index c6293c701..7eb7100f2 100644
3434
}
3535

3636
func (c *builderFileSource) GetFile(fileName string) FileHandle {
37-
@@ -114,7 +114,7 @@ func (c *compilerHost) GetResolvedProjectReference(fileName string, path tspath.
37+
@@ -115,7 +115,7 @@ func (c *compilerHost) GetResolvedProjectReference(fileName string, path tspath.
3838
return c.configFileRegistry.GetConfig(path)
3939
} else {
4040
c.seenFiles.Add(path)

patches/0005-feat-improve-panic-message-for-extracting-TS-extensi.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 427441043948000571f5de46dc1433d9c098f4d5 Mon Sep 17 00:00:00 2001
1+
From 0eeeff5866daf575b17d294164e8be13556b532c Mon Sep 17 00:00:00 2001
22
From: Cameron Clark <[email protected]>
33
Date: Wed, 22 Oct 2025 09:32:18 +0100
44
Subject: [PATCH] feat: improve panic message for extracting TS extension

patches/0006-fix-panic-when-compiling-wildcard-directories-patter.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From f43fdaac5a05b83b47a6341a5f218b4be0ff34f4 Mon Sep 17 00:00:00 2001
1+
From bddd1fb15663894bbb584e2d6091ae3ab05179a7 Mon Sep 17 00:00:00 2001
22
From: Cameron Clark <[email protected]>
33
Date: Fri, 24 Oct 2025 11:24:09 +0100
44
Subject: [PATCH] fix panic when compiling wildcard directories pattern

0 commit comments

Comments
 (0)