Skip to content

Commit 720e3bb

Browse files
committed
Fix loop
1 parent 9d9c2d8 commit 720e3bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/run-prettier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ export async function runPrettier(
116116
{ cwd: directory },
117117
);
118118

119-
// Remove the useless head
120119
const lines = diff.split("\n");
121-
for (let lineIndex = lines.length - 1; lineIndex > 0; lineIndex--) {
120+
for (let lineIndex = lines.length - 1; lineIndex >= 0; lineIndex--) {
122121
if (
123122
lines[lineIndex].startsWith("diff --git Original|") &&
124123
lines[lineIndex + 1].startsWith("index ") &&
125124
lines[lineIndex + 2].startsWith("--- Original|http://github.com/") &&
126125
lines[lineIndex + 3].startsWith("+++ Alternative|")
127126
) {
127+
// Remove the useless head
128128
lines.splice(lineIndex, 2);
129129
}
130130
}

0 commit comments

Comments
 (0)