From 129429889f0c3197c67c2a743f5c90e99f2f70e4 Mon Sep 17 00:00:00 2001 From: shihanwan Date: Thu, 2 May 2024 14:19:54 -0400 Subject: [PATCH] address review comments --- packages/bumpgen-core/src/services/matching/index.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/bumpgen-core/src/services/matching/index.ts b/packages/bumpgen-core/src/services/matching/index.ts index 8bdf91a..0933372 100644 --- a/packages/bumpgen-core/src/services/matching/index.ts +++ b/packages/bumpgen-core/src/services/matching/index.ts @@ -7,13 +7,9 @@ const trimCode = (code: string) => code.split("\n").map((line) => line.trim()); export const formatNewCode = (firstMatchedLine: string, newCode: string) => { const countIndents = (line: string) => { let count = 0; - // eslint-disable-next-line @typescript-eslint/prefer-for-of - for (let i = 0; i < line.length; i++) { - if (line[i] === " " || line[i] === "\t") { - count++; - } else { - break; - } + for (const char of line) { + if (char === " " || char === "\t") count++; + else break; } return count; };