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

Commit 37b216c

Browse files
committed
Fix line endings regex
1 parent 13cc147 commit 37b216c

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
@@ -473,7 +473,10 @@ function makeChecker(expectedForm: any, expectedFormUrl: string, options?: { par
473473
? prettier.format(JSON.stringify(suggestion), { tabWidth: 4, filepath: ".json" })
474474
: JSON.stringify(suggestion, undefined, 4) + "\n"
475475
).split(/^/m);
476-
const lines = newText.split(/^/m);
476+
// "^" will match inside LineTerminatorSequence so
477+
// "\r\n".split(/^/m) is two lines. Sigh.
478+
// https://tc39.es/ecma262/#_ref_7303:~:text=the%20character%20Input%5Be%20%2D%201%5D%20is%20one%20of%20LineTerminator
479+
const lines = newText.replace(/\r\n/g, "\n").split(/^/m);
477480
// When suggestionLines is empty, that suggests removing all
478481
// of the different lines
479482
let startLine = 1;

0 commit comments

Comments
 (0)