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

Commit b978ab2

Browse files
committed
Fix line endings regex
1 parent 99ca91d commit b978ab2

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

0 commit comments

Comments
 (0)