Skip to content

Commit 19eb2e3

Browse files
committed
fix(lint): disable noImportAssign for tests and fix duplicate beforeEach
- Add noImportAssign override for test files (needed for immutability tests) - Fix duplicate beforeEach in test/stdio/footer.test.ts (convert second one to afterEach) - Apply additional auto-fixes from biome All lint checks now pass successfully.
1 parent 1744022 commit 19eb2e3

11 files changed

Lines changed: 21 additions & 11 deletions

biome.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,22 @@
143143
},
144144
"suspicious": {
145145
"noExplicitAny": "off",
146+
"noImportAssign": "off",
146147
"noShadowRestrictedNames": "off"
147148
}
148149
}
149150
}
150151
},
152+
{
153+
"includes": ["test/**/*.ts"],
154+
"linter": {
155+
"rules": {
156+
"suspicious": {
157+
"noImportAssign": "off"
158+
}
159+
}
160+
}
161+
},
151162
{
152163
"includes": ["registry/src/external/**/*.d.ts"],
153164
"linter": {

test/cacache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @fileoverview Unit tests for cacache utility wrapper.
33
*/
44

5-
import { beforeEach, describe, expect, it, vi } from 'vitest'
5+
import { describe, expect, it, vi } from 'vitest'
66

77
import {
88
clear,

test/constants/agents.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
BUN_LOCKB,
1111
NPM,
1212
NPM_BIN_PATH,
13-
NPM_LOCK_JSON,
1413
NPM_REAL_EXEC_PATH,
1514
NPM_REGISTRY_URL,
1615
NPM_SHRINKWRAP_JSON,

test/constants/packages.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('constants/packages', () => {
9898
it('should be iterable with for-of', () => {
9999
const extensions = getPackageExtensions()
100100
let count = 0
101-
for (const [key, value] of extensions) {
101+
for (const [key, _value] of extensions) {
102102
expect(typeof key).toBe('string')
103103
count++
104104
}
@@ -172,7 +172,7 @@ describe('constants/packages', () => {
172172

173173
it('should be mutable Map', () => {
174174
const cache = getPackumentCache()
175-
const key = 'test-key-' + Date.now()
175+
const key = `test-key-${Date.now()}`
176176
const value = { test: true }
177177

178178
cache.set(key, value)

test/download-lock.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import { existsSync } from 'node:fs'
6-
import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises'
6+
import { mkdir, readdir, rm, writeFile } from 'node:fs/promises'
77
import { join } from 'node:path'
88
import { tmpdir } from 'node:os'
99
import { downloadWithLock } from '@socketsecurity/lib/download-lock'

test/env/home.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('env/home', () => {
111111
})
112112

113113
it('should handle very long paths', () => {
114-
const longPath = '/home/' + 'a'.repeat(200)
114+
const longPath = `/home/${'a'.repeat(200)}`
115115
setEnv('HOME', longPath)
116116
expect(getHome()).toBe(longPath)
117117
})

test/env/node-auth-token.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('env/node-auth-token', () => {
8282
expect(getNodeAuthToken()).toBe('test-token')
8383

8484
clearEnv('NODE_AUTH_TOKEN')
85-
const result = clearEnv('NODE_AUTH_TOKEN')
85+
const _result = clearEnv('NODE_AUTH_TOKEN')
8686
expect(typeof getNodeAuthToken()).toMatch(/string|undefined/)
8787

8888
setEnv('NODE_AUTH_TOKEN', 'new-token')

test/env/socket-cli-shadow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe('env/socket-cli-shadow', () => {
7979
})
8080

8181
it('should handle long API token', () => {
82-
const longToken = 'sock_' + 'a'.repeat(100)
82+
const longToken = `sock_${'a'.repeat(100)}`
8383
setEnv('SOCKET_CLI_SHADOW_API_TOKEN', longToken)
8484
expect(getSocketCliShadowApiToken()).toBe(longToken)
8585
})

test/env/temp-dir.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('env/temp-dir', () => {
7575
})
7676

7777
it('should handle long tmpdir path', () => {
78-
const longPath = '/a'.repeat(100) + '/tmp'
78+
const longPath = `${'/a'.repeat(100)}/tmp`
7979
setEnv('TMPDIR', longPath)
8080
expect(getTmpdir()).toBe(longPath)
8181
})

test/stdio/footer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('stdio/footer', () => {
1919
dateNowSpy = vi.spyOn(Date, 'now').mockReturnValue(1_000_000)
2020
})
2121

22-
beforeEach(() => {
22+
afterEach(() => {
2323
if (dateNowSpy) {
2424
dateNowSpy.mockRestore()
2525
}

0 commit comments

Comments
 (0)