From 0adc3bcab93d2fbd72ec913d784111b2c88847d1 Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Thu, 29 Aug 2024 23:01:12 +0300 Subject: [PATCH] fix: message with newline --- src/lint/formatter.ts | 2 +- test/lint/formatter.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lint/formatter.ts b/src/lint/formatter.ts index 494738a..1558d2e 100644 --- a/src/lint/formatter.ts +++ b/src/lint/formatter.ts @@ -51,7 +51,7 @@ export class Formatter { } private normalizeMessages(result: LintResult) { - const newLineRegex = /[\s\n]{2,}/g + const newLineRegex = /\s*\n\s*/g const messages = result.messages.map(message => { return { diff --git a/test/lint/formatter.test.ts b/test/lint/formatter.test.ts index 79c7d65..2efca76 100644 --- a/test/lint/formatter.test.ts +++ b/test/lint/formatter.test.ts @@ -153,7 +153,7 @@ describe('Formatter', () => { messages: [ { ...message1, - message: 'message\na\t\nb \nc' + message: 'message\na\t\nb \nc \n\td\t\n e' } ] } @@ -165,7 +165,7 @@ describe('Formatter', () => { messages: [ { ...message1, - message: 'message a b c' + message: 'message a b c d e' } ], errorCount: expect.any(Number),