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

Commit c55a93a

Browse files
committed
Fix line endings regex
1 parent 003026c commit c55a93a

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
@@ -491,7 +491,10 @@ function makeJsonCheckerFromCore(requiredForm: any, ignoredKeys: string[], requi
491491
? prettier.format(JSON.stringify(suggestion), { tabWidth: 4, filepath: ".json" })
492492
: JSON.stringify(suggestion, undefined, 4) + "\n"
493493
).split(/^/m);
494-
const lines = newText.split(/^/m);
494+
// "^" will match inside LineTerminatorSequence so
495+
// "\r\n".split(/^/m) is two lines. Sigh.
496+
// https://tc39.es/ecma262/#_ref_7303:~:text=the%20character%20Input%5Be%20%2D%201%5D%20is%20one%20of%20LineTerminator
497+
const lines = newText.replace(/\r\n/g, "\n").split(/^/m);
495498
// When suggestionLines is empty, that suggests removing all
496499
// of the different lines
497500
let startLine = 1;

0 commit comments

Comments
 (0)