From 348dcc47fdf0b9b074144def58d0b02d22b01522 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Thu, 25 Apr 2024 12:13:41 +0200 Subject: [PATCH] Generated docs should use Unix line endings on Windows --- .gitattributes | 5 ++++- lint/generate-docs.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 406640bfcc9..b5ad93b1bc6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,4 +13,7 @@ *.css eol=lf *.scss eol=lf *.html eol=lf -*.svg eol=lf \ No newline at end of file +*.svg eol=lf + +# Generated documentation should have LF line endings to reduce git noise +docs/lint/**/*.md eol=lf \ No newline at end of file diff --git a/lint/generate-docs.ts b/lint/generate-docs.ts index ccc58994a2a..fb2bf53fb58 100644 --- a/lint/generate-docs.ts +++ b/lint/generate-docs.ts @@ -20,12 +20,12 @@ import { default as tsPlugin } from './src/rules/ts'; const templates = new Map(); -function lazyEJS(path: string, data: object) { +function lazyEJS(path: string, data: object): string { if (!templates.has(path)) { templates.set(path, require('ejs').compile(readFileSync(path).toString())); } - return templates.get(path)(data); + return templates.get(path)(data).replace(/\r\n/g, '\n'); } const docsDir = join('docs', 'lint');