Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 86241b9

Browse files
committed
Fix line endings regex
1 parent cba2225 commit 86241b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pr-info.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ function makeChecker(expectedForm: any, expectedFormUrl: string, options?: { par
475475
? prettier.format(JSON.stringify(suggestion), { tabWidth: 4, filepath: ".json" })
476476
: JSON.stringify(suggestion, undefined, 4) + "\n"
477477
).split(/^/m);
478-
const lines = newText.split(/^/m);
478+
// "^" will match inside LineTerminatorSequence so
479+
// "\r\n".split(/^/m) is two lines. Sigh.
480+
// https://tc39.es/ecma262/#_ref_7303:~:text=the%20character%20Input%5Be%20%2D%201%5D%20is%20one%20of%20LineTerminator
481+
const lines = newText.replace(/\r\n/g, "\n").split(/^/m);
479482
// When suggestionLines is empty, that suggests removing all
480483
// of the different lines
481484
let startLine = 1;

0 commit comments

Comments
 (0)