Skip to content

Commit 7290d44

Browse files
Improving error message when CRLF line endings are encountered
1 parent 492a306 commit 7290d44

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

utils/snippetParser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ function raise(issue, snippet = '') {
1616
return null;
1717
}
1818

19+
const crlfRegex = /\r\n/gm;
1920
const propertyRegex = /^\s+([a-zA-Z]+):\s*(.+)/;
2021
const headerEndCodeStartRegex = /^\s*---\s*```.*\n/;
2122
const codeRegex = /^(.+)```/s
2223
function parseSnippet(snippetPath, text) {
24+
if(crlfRegex.exec(text) !== null) return raise('Found CRLF line endings instead of LF line endings', snippetPath);
2325
let cursor = 0;
2426

2527
const fromCursor = () => text.substring(cursor);

0 commit comments

Comments
 (0)