@ttsc/lint 0.16.9 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/linthost/compile.go +8 -4
- package/linthost/host.go +10 -3
- package/package.json +2 -2
package/linthost/compile.go
CHANGED
|
@@ -26,6 +26,7 @@ import (
|
|
|
26
26
|
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
27
27
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
28
28
|
shimdw "github.com/microsoft/typescript-go/shim/diagnosticwriter"
|
|
29
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
// RunCheck implements `@ttsc/lint check` — typecheck + lint, no emit.
|
|
@@ -118,10 +119,13 @@ func RunTransform(args []string) int {
|
|
|
118
119
|
return 2
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
// tsgo normalizes SourceFile.FileName() through tspath, resolving "."/".."
|
|
123
|
+
// segments as well as separators. findSourceFile's comparison only swaps
|
|
124
|
+
// separators, so an absolute --file value carrying an unresolved "."/".."
|
|
125
|
+
// round-trip (or, on a POSIX host, backslash separators) could name the
|
|
126
|
+
// right file and still miss (samchon/ttsc#319 is this same gap in ttsc's
|
|
127
|
+
// resident serve host).
|
|
128
|
+
absFile := shimtspath.ResolvePath(resolvedCwd, *file)
|
|
125
129
|
target := prog.findSourceFile(absFile)
|
|
126
130
|
if target == nil {
|
|
127
131
|
fmt.Fprintf(os.Stderr, "@ttsc/lint transform: source file not in program: %s\n", absFile)
|
package/linthost/host.go
CHANGED
|
@@ -22,6 +22,7 @@ import (
|
|
|
22
22
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
23
23
|
shimcore "github.com/microsoft/typescript-go/shim/core"
|
|
24
24
|
"github.com/microsoft/typescript-go/shim/tsoptions"
|
|
25
|
+
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
25
26
|
"github.com/microsoft/typescript-go/shim/vfs/cachedvfs"
|
|
26
27
|
"github.com/microsoft/typescript-go/shim/vfs/osvfs"
|
|
27
28
|
)
|
|
@@ -227,11 +228,17 @@ func (p *program) programDiagnostics() []*shimast.Diagnostic {
|
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
// findSourceFile locates a source file in the program by absolute path.
|
|
230
|
-
// tsgo normalizes
|
|
231
|
+
// tsgo normalizes SourceFile.FileName() through tspath (forward slashes,
|
|
232
|
+
// resolved "."/".." segments); a bare filepath.ToSlash only swaps separator
|
|
233
|
+
// characters for the host OS, so a caller-supplied path with an unresolved
|
|
234
|
+
// "."/".." round-trip (or, on a POSIX host, backslash separators surviving
|
|
235
|
+
// from a Windows-authored path) could still fail to match here even after
|
|
236
|
+
// that conversion. Normalize both sides through tspath instead — the same gap
|
|
237
|
+
// this closes in ttsc's resident serve host (samchon/ttsc#319).
|
|
231
238
|
func (p *program) findSourceFile(target string) *shimast.SourceFile {
|
|
232
|
-
want :=
|
|
239
|
+
want := shimtspath.NormalizePath(target)
|
|
233
240
|
for _, file := range p.tsProgram.SourceFiles() {
|
|
234
|
-
if
|
|
241
|
+
if shimtspath.NormalizePath(file.FileName()) == want {
|
|
235
242
|
return file
|
|
236
243
|
}
|
|
237
244
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttsc/lint",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.10",
|
|
4
4
|
"description": "Reference ttsc plugin: ESLint-style lint rules hosted in the same Program/Checker as the type-check pass.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/node": "^25.3.0",
|
|
37
37
|
"rimraf": "^6.1.2",
|
|
38
38
|
"typescript": "7.0.1-rc",
|
|
39
|
-
"ttsc": "0.16.
|
|
39
|
+
"ttsc": "0.16.10"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|