Skip to content

Commit b382639

Browse files
committed
Apply lint on last pnp changes
1 parent f3c6477 commit b382639

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

internal/module/resolver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,9 +2055,9 @@ func GetAutomaticTypeDirectiveNames(options *core.CompilerOptions, host Resoluti
20552055
}
20562056

20572057
var result []string
2058-
typeRoots, fromConfig := options.GetEffectiveTypeRoots(host.GetCurrentDirectory())
2058+
typeRoots, _ := options.GetEffectiveTypeRoots(host.GetCurrentDirectory())
20592059
if pnpApi := host.PnpApi(); pnpApi != nil {
2060-
typeRoots, fromConfig = pnpApi.AppendPnpTypeRoots(typeRoots, host.GetCurrentDirectory(), options, fromConfig)
2060+
typeRoots, _ = pnpApi.AppendPnpTypeRoots(typeRoots, host.GetCurrentDirectory(), options, false)
20612061
}
20622062
for _, root := range typeRoots {
20632063
if host.FS().DirectoryExists(root) {

internal/vfs/pnpvfs/pnpvfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type pnpFS struct {
2121

2222
var _ vfs.FS = (*pnpFS)(nil)
2323

24-
func From(fs vfs.FS) *pnpFS {
24+
func From(fs vfs.FS) vfs.FS {
2525
pnpFS := &pnpFS{
2626
fs: fs,
2727
cachedZipReadersMap: make(map[string]*zip.ReadCloser),

internal/vfs/pnpvfs/pnpvfs_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package pnpvfs_test
1+
package pnpvfs
22

33
import (
44
"archive/zip"
@@ -10,7 +10,6 @@ import (
1010
"github.com/microsoft/typescript-go/internal/tspath"
1111
"github.com/microsoft/typescript-go/internal/vfs"
1212
"github.com/microsoft/typescript-go/internal/vfs/osvfs"
13-
"github.com/microsoft/typescript-go/internal/vfs/pnpvfs"
1413
"github.com/microsoft/typescript-go/internal/vfs/vfstest"
1514
"gotest.tools/v3/assert"
1615
)
@@ -35,10 +34,10 @@ func createTestZip(t *testing.T, files map[string]string) (string, vfs.FS) {
3534
assert.NilError(t, err)
3635
}
3736

38-
fs := pnpvfs.From(osvfs.FS())
37+
fs := From(osvfs.FS())
3938

4039
t.Cleanup(func() {
41-
errClear := fs.ClearCache()
40+
errClear := fs.(*pnpFS).ClearCache()
4241
assert.NilError(t, errClear)
4342
})
4443

@@ -53,7 +52,7 @@ func TestPnpVfs_BasicFileOperations(t *testing.T) {
5352
"/project/package.json": `{"name": "test"}`,
5453
}, true)
5554

56-
fs := pnpvfs.From(underlyingFS)
55+
fs := From(underlyingFS)
5756
assert.Assert(t, fs.FileExists("/project/src/index.ts"))
5857
assert.Assert(t, !fs.FileExists("/project/nonexistent.ts"))
5958

@@ -106,7 +105,7 @@ func TestPnpVfs_ZipFileDetection(t *testing.T) {
106105
func TestPnpVfs_ErrorHandling(t *testing.T) {
107106
t.Parallel()
108107

109-
fs := pnpvfs.From(osvfs.FS())
108+
fs := From(osvfs.FS())
110109

111110
t.Run("NonexistentZipFile", func(t *testing.T) {
112111
t.Parallel()
@@ -147,9 +146,9 @@ func TestPnpVfs_ErrorHandling(t *testing.T) {
147146
func TestPnpVfs_CaseSensitivity(t *testing.T) {
148147
t.Parallel()
149148

150-
sensitiveFS := pnpvfs.From(vfstest.FromMap(map[string]string{}, true))
149+
sensitiveFS := From(vfstest.FromMap(map[string]string{}, true))
151150
assert.Assert(t, sensitiveFS.UseCaseSensitiveFileNames())
152-
insensitiveFS := pnpvfs.From(vfstest.FromMap(map[string]string{}, false))
151+
insensitiveFS := From(vfstest.FromMap(map[string]string{}, false))
153152
// pnpvfs is always case sensitive
154153
assert.Assert(t, insensitiveFS.UseCaseSensitiveFileNames())
155154
}
@@ -162,7 +161,7 @@ func TestPnpVfs_FallbackToRegularFiles(t *testing.T) {
162161
err := os.WriteFile(regularFile, []byte("regular content"), 0o644)
163162
assert.NilError(t, err)
164163

165-
fs := pnpvfs.From(osvfs.FS())
164+
fs := From(osvfs.FS())
166165

167166
assert.Assert(t, fs.FileExists(regularFile))
168167

@@ -206,7 +205,7 @@ func TestPnpVfs_VirtualPathHandling(t *testing.T) {
206205
"/project/packages/packageB/package.json": `{"name": "packageB"}`,
207206
}, true)
208207

209-
fs := pnpvfs.From(underlyingFS)
208+
fs := From(underlyingFS)
210209
assert.Assert(t, fs.FileExists("/project/packages/__virtual__/packageA-virtual-123456/0/packageA/package.json"))
211210
assert.Assert(t, fs.FileExists("/project/packages/subfolder/__virtual__/packageA-virtual-123456/1/packageA/package.json"))
212211

0 commit comments

Comments
 (0)