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

Commit 0e18000

Browse files
committed
Fix line endings regex
1 parent 71df39a commit 0e18000

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

0 commit comments

Comments
 (0)