From a896e3d52e9edb067ca39a1f05853762f575479a Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 31 Jan 2025 12:35:13 -0800 Subject: [PATCH] lint --- .../agents/spelunker/src/typescriptChunker.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ts/packages/agents/spelunker/src/typescriptChunker.ts b/ts/packages/agents/spelunker/src/typescriptChunker.ts index e439eb33..d268e027 100644 --- a/ts/packages/agents/spelunker/src/typescriptChunker.ts +++ b/ts/packages/agents/spelunker/src/typescriptChunker.ts @@ -36,7 +36,9 @@ export async function chunkifyTypeScriptFiles( const baseName = path.basename(fileName); const extName = path.extname(fileName); const codeName = baseName.slice(0, -extName.length || undefined); - const blobs: Blob[] = [{ start: 0, lines: sourceFile.text.match(/.*(?:\r?\n|$)/g) || [] }]; + const blobs: Blob[] = [ + { start: 0, lines: sourceFile.text.match(/.*(?:\r?\n|$)/g) || [] }, + ]; const rootChunk: Chunk = { chunkId: generate_id(), treeName: "file", @@ -110,10 +112,20 @@ function spliceBlobs(parentChunk: Chunk, childChunk: Chunk): void { assert(childBlobs.length === 1, "Child chunk must have exactly one blob"); const parentBlob = parentBlobs[parentBlobs.length - 1]; const childBlob = childBlobs[0]; - assert(childBlob.start >= parentBlob.start, "Child blob must start after parent blob"); - assert(childBlob.start + childBlob.lines.length <= parentBlob.start + parentBlob.lines.length, "Child blob must end before parent blob"); + assert( + childBlob.start >= parentBlob.start, + "Child blob must start after parent blob", + ); + assert( + childBlob.start + childBlob.lines.length <= + parentBlob.start + parentBlob.lines.length, + "Child blob must end before parent blob", + ); - const linesBefore = parentBlob.lines.slice(0, childBlob.start - parentBlob.start); + const linesBefore = parentBlob.lines.slice( + 0, + childBlob.start - parentBlob.start, + ); const startBefore = parentBlob.start; while (linesBefore.length && !linesBefore[linesBefore.length - 1].trim()) { linesBefore.pop();