Procházet zdrojové kódy

fix(lint): clear contracts-ready findings in the mode-model batch

imccyu před 3 týdny
rodič
revize
86357f5f01

+ 2 - 1
apps/web/tests/hmr-live.e2e.ts

@@ -2,6 +2,7 @@
 
 import { existsSync, globSync } from 'node:fs'
 import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { randomUUID } from 'node:crypto'
 import { tmpdir } from 'node:os'
 import { join } from 'node:path'
 import { chromium } from 'playwright'
@@ -114,7 +115,7 @@ it('hot-reloads a real client-plugin source edit without refreshing the page', a
     await page.goto(baseUrl, { waitUntil: 'load' })
     await page.getByText(oldText, { exact: true }).waitFor({ timeout: 15_000 })
     const pageIdentity = await page.evaluate(() => {
-      const identity = crypto.randomUUID()
+      const identity = randomUUID()
       Object.defineProperty(window, '__dshHmrPageIdentity', { value: identity })
       return identity
     })

+ 2 - 1
apps/web/tests/subagent-interrupt.e2e.ts

@@ -5,6 +5,7 @@
 // parked without auto-starting a new turn, and a later waking send resumed the
 // preserved FIFO order. No browser: the RPC surface is the product surface
 // under test, and subagent-interrupt-ui.e2e.ts owns the composer interaction.
+import { randomUUID } from 'node:crypto'
 import { existsSync } from 'node:fs'
 import { mkdtemp, rm, writeFile } from 'node:fs/promises'
 import { tmpdir } from 'node:os'
@@ -28,7 +29,7 @@ async function rpc<T>(baseUrl: string, method: string, payload: unknown): Promis
     headers: { 'content-type': 'application/json' },
     body: JSON.stringify({
       type: 'client-request',
-      rpcId: `interrupt-e2e-${method}-${crypto.randomUUID()}`,
+      rpcId: `interrupt-e2e-${method}-${randomUUID()}`,
       method,
       payload,
     }),

+ 3 - 2
packages/experimental/webworker-runtime/src/storage/memory.ts

@@ -131,7 +131,8 @@ export class MemoryVfs {
       this.writeFileSync(path, data, options)
     },
     appendFile: async (path: string, data: string | Uint8Array): Promise<void> => { this.appendFileSync(path, data) },
-    mkdir: async (path: string, options?: { recursive?: boolean; mode?: number }): Promise<string | undefined> => this.mkdirSync(path, options),
+    mkdir: async (path: string, options?: { recursive?: boolean; mode?: number }): Promise<string | undefined> =>
+      this.mkdirSync(path, options),
     readdir: async (path: string, options?: { withFileTypes?: boolean }): Promise<string[] & VfsDirent[]> =>
       this.readdirSync(path, options),
     stat: async (path: string, options?: VfsStatOptions): Promise<VfsStats | VfsBigIntStats> => this.statSync(path, options),
@@ -441,7 +442,7 @@ export class MemoryVfs {
     const merged = new Uint8Array(existing.bytes.length + addition.length)
     merged.set(existing.bytes)
     merged.set(addition, existing.bytes.length)
-    this.files.set(target, { bytes: merged, mtimeMs: this.touch(target), mode: existing?.mode ?? DEFAULT_FILE_MODE })
+    this.files.set(target, { bytes: merged, mtimeMs: this.touch(target), mode: existing.mode })
   }
 
   /**

+ 2 - 2
packages/experimental/webworker-runtime/tests/node/crypto-globals.spec.ts

@@ -24,13 +24,13 @@ describe('installCryptoGlobals', () => {
     const bare = { getRandomValues: globalThis.crypto.getRandomValues.bind(globalThis.crypto) }
     vi.stubGlobal('crypto', bare)
     installCryptoGlobals()
-    expect((globalThis.crypto as Crypto).randomUUID()).toMatch(V4_SHAPE)
+    expect(globalThis.crypto.randomUUID()).toMatch(V4_SHAPE)
   })
 
   it('leaves a platform that already provides randomUUID untouched', () => {
     const platform = (): string => 'platform-owned'
     vi.stubGlobal('crypto', { randomUUID: platform })
     installCryptoGlobals()
-    expect(globalThis.crypto.randomUUID).toBe(platform)
+    expect(Reflect.get(globalThis.crypto, 'randomUUID')).toBe(platform)
   })
 })

+ 1 - 1
packages/experimental/webworker-runtime/tests/node/fs.spec.ts

@@ -208,7 +208,7 @@ check('a directory reports the creation-default mode in the bigint shape', Numbe
 // into place, then the provider stats the result).
 // ---------------------------------------------------------------------------
 
-const plainMode = (path: string): number => Number((fs.statSync(path) as VfsStats).mode) & 0o777
+const plainMode = (path: string): number => (fs.statSync(path) as VfsStats).mode & 0o777
 
 fs.writeFileSync('/dsh/secrets.tmp', 'k: v\n', { mode: 0o600, flag: 'wx' })
 fs.renameSync('/dsh/secrets.tmp', '/dsh/secrets.yaml')