Skip to content

Commit 276c47d

Browse files
committed
Fix lint nits
1 parent 4c9b7f8 commit 276c47d

3 files changed

Lines changed: 29 additions & 26 deletions

File tree

src/commands/fix/cmd-fix.test.mts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ describe('socket fix', async () => {
369369
'should handle vulnerable dependencies fixture project',
370370
async cmd => {
371371
const { tempDir, cleanup } = await withTempFixture(
372-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
372+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
373373
)
374374
cleanupFunctions.push(cleanup)
375375

@@ -390,7 +390,7 @@ describe('socket fix', async () => {
390390
'should handle monorepo fixture project',
391391
async cmd => {
392392
const { tempDir, cleanup } = await withTempFixture(
393-
path.join(fixtureBaseDir, 'pnpm/monorepo')
393+
path.join(fixtureBaseDir, 'pnpm/monorepo'),
394394
)
395395
cleanupFunctions.push(cleanup)
396396

@@ -541,7 +541,7 @@ describe('socket fix', async () => {
541541
'should handle PURL-based vulnerability identification',
542542
async cmd => {
543543
const { tempDir, cleanup } = await withTempFixture(
544-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
544+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
545545
)
546546
cleanupFunctions.push(cleanup)
547547

@@ -568,7 +568,7 @@ describe('socket fix', async () => {
568568
'should handle multiple vulnerability IDs in comma-separated format',
569569
async cmd => {
570570
const { tempDir, cleanup } = await withTempFixture(
571-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
571+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
572572
)
573573
cleanupFunctions.push(cleanup)
574574

@@ -597,7 +597,7 @@ describe('socket fix', async () => {
597597
'should handle multiple vulnerability IDs as separate flags',
598598
async cmd => {
599599
const { tempDir, cleanup } = await withTempFixture(
600-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
600+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
601601
)
602602
cleanupFunctions.push(cleanup)
603603

@@ -628,7 +628,7 @@ describe('socket fix', async () => {
628628
'should handle autopilot mode with JSON output and custom limit',
629629
async cmd => {
630630
const { tempDir, cleanup } = await withTempFixture(
631-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
631+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
632632
)
633633
cleanupFunctions.push(cleanup)
634634

@@ -658,7 +658,7 @@ describe('socket fix', async () => {
658658
'should handle monorepo with pin style and markdown output',
659659
async cmd => {
660660
const { tempDir, cleanup } = await withTempFixture(
661-
path.join(fixtureBaseDir, 'pnpm/monorepo')
661+
path.join(fixtureBaseDir, 'pnpm/monorepo'),
662662
)
663663
cleanupFunctions.push(cleanup)
664664

@@ -767,7 +767,7 @@ describe('socket fix', async () => {
767767
'should handle non-existent GHSA IDs gracefully',
768768
async cmd => {
769769
const { tempDir, cleanup } = await withTempFixture(
770-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
770+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
771771
)
772772
cleanupFunctions.push(cleanup)
773773

@@ -792,7 +792,7 @@ describe('socket fix', async () => {
792792
'should show clear error when both json and markdown flags are used',
793793
async cmd => {
794794
const { tempDir, cleanup } = await withTempFixture(
795-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
795+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
796796
)
797797
cleanupFunctions.push(cleanup)
798798

@@ -828,7 +828,7 @@ describe('socket fix', async () => {
828828
'should handle malformed CVE IDs gracefully',
829829
async cmd => {
830830
const { tempDir, cleanup } = await withTempFixture(
831-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
831+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
832832
)
833833
cleanupFunctions.push(cleanup)
834834

@@ -861,7 +861,7 @@ describe('socket fix', async () => {
861861
'should handle unusually long tokens gracefully',
862862
async cmd => {
863863
const { tempDir, cleanup } = await withTempFixture(
864-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
864+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
865865
)
866866
cleanupFunctions.push(cleanup)
867867

@@ -886,7 +886,7 @@ describe('socket fix', async () => {
886886
'should handle mixed valid and invalid vulnerability IDs',
887887
async cmd => {
888888
const { tempDir, cleanup } = await withTempFixture(
889-
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps')
889+
path.join(fixtureBaseDir, 'pnpm/vulnerable-deps'),
890890
)
891891
cleanupFunctions.push(cleanup)
892892

src/commands/optimize/cmd-optimize-pnpm-versions.test.mts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@ describe('socket optimize - pnpm versions', { timeout: 60_000 }, async () => {
3232
})
3333

3434
describe('pnpm v8', () => {
35-
3635
it(
3736
'should optimize packages with pnpm v8',
3837
{ timeout: 30_000 },
3938
async () => {
4039
// Create temp fixture for pnpm8.
4140
const { tempDir: pnpm8FixtureDir, cleanup } = await withTempFixture(
42-
path.join(fixtureBaseDir, 'pnpm8')
41+
path.join(fixtureBaseDir, 'pnpm8'),
4342
)
4443
cleanupFunctions.push(cleanup)
4544

@@ -118,7 +117,7 @@ describe('socket optimize - pnpm versions', { timeout: 60_000 }, async () => {
118117
async () => {
119118
// Create temp fixture for pnpm8.
120119
const { tempDir: pnpm8FixtureDir, cleanup } = await withTempFixture(
121-
path.join(fixtureBaseDir, 'pnpm8')
120+
path.join(fixtureBaseDir, 'pnpm8'),
122121
)
123122
cleanupFunctions.push(cleanup)
124123

@@ -178,14 +177,13 @@ describe('socket optimize - pnpm versions', { timeout: 60_000 }, async () => {
178177
})
179178

180179
describe('pnpm v9', () => {
181-
182180
it(
183181
'should optimize packages with pnpm v9',
184182
{ timeout: 30_000 },
185183
async () => {
186184
// Create temp fixture for pnpm9.
187185
const { tempDir: pnpm9FixtureDir, cleanup } = await withTempFixture(
188-
path.join(fixtureBaseDir, 'pnpm9')
186+
path.join(fixtureBaseDir, 'pnpm9'),
189187
)
190188
cleanupFunctions.push(cleanup)
191189

@@ -260,7 +258,7 @@ describe('socket optimize - pnpm versions', { timeout: 60_000 }, async () => {
260258
async () => {
261259
// Create temp fixture for pnpm9.
262260
const { tempDir: pnpm9FixtureDir, cleanup } = await withTempFixture(
263-
path.join(fixtureBaseDir, 'pnpm9')
261+
path.join(fixtureBaseDir, 'pnpm9'),
264262
)
265263
cleanupFunctions.push(cleanup)
266264

src/utils/test-fixtures.mts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import trash from 'trash'
1414
*/
1515
export async function createTempFixture(
1616
fixturePath: string,
17-
cleanupHook?: (cleanup: () => Promise<void>) => void
17+
cleanupHook?: (cleanup: () => Promise<void>) => void,
1818
): Promise<string> {
1919
// Create a unique temporary directory.
2020
const tempBaseDir = tmpdir()
@@ -25,7 +25,7 @@ export async function createTempFixture(
2525
await fs.cp(fixturePath, tempDir, {
2626
recursive: true,
2727
// Preserve file permissions and timestamps.
28-
preserveTimestamps: true
28+
preserveTimestamps: true,
2929
})
3030

3131
// Register cleanup if hook provided.
@@ -51,12 +51,13 @@ export async function createTempFixture(
5151
*/
5252
export async function createTempFixtures(
5353
fixtures: Record<string, string>,
54-
cleanupHook?: (cleanup: () => Promise<void>) => void
54+
cleanupHook?: (cleanup: () => Promise<void>) => void,
5555
): Promise<Record<string, string>> {
56-
const tempFixtures: Record<string, string> = { __proto__: null } as Record<string, string>
56+
const tempFixtures = { __proto__: null } as unknown as Record<string, string>
5757
const tempDirs: string[] = []
5858

5959
for (const [name, fixturePath] of Object.entries(fixtures)) {
60+
// eslint-disable-next-line no-await-in-loop
6061
const tempDir = await createTempFixture(fixturePath)
6162
tempFixtures[name] = tempDir
6263
tempDirs.push(tempDir)
@@ -65,9 +66,13 @@ export async function createTempFixtures(
6566
// Register cleanup for all temp directories.
6667
if (cleanupHook) {
6768
cleanupHook(async () => {
68-
await Promise.all(tempDirs.map(dir => trash(dir).catch(() => {
69-
// Ignore cleanup errors.
70-
})))
69+
await Promise.all(
70+
tempDirs.map(dir =>
71+
trash(dir).catch(() => {
72+
// Ignore cleanup errors.
73+
}),
74+
),
75+
)
7176
})
7277
}
7378

@@ -96,4 +101,4 @@ export async function withTempFixture(fixturePath: string): Promise<{
96101
}
97102

98103
return { tempDir, cleanup }
99-
}
104+
}

0 commit comments

Comments
 (0)