Skip to content

Commit

Permalink
fix: message with newline
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni55aN committed Aug 30, 2024
1 parent 68af5aa commit 4dd4987
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/lint/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export class Formatter {
}

private normalizeMessages(result: LintResult) {
const newLineRegex = /[\s\n]{2,}/g

const messages = result.messages.map(message => {
return {
...message,
message: message.message.replace(newLineRegex, ' ')
message: message.message.split(/\n/g)
.map(line => line.trim())
.join(' ')
}
})

Expand Down
4 changes: 2 additions & 2 deletions test/lint/formatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
]
}
Expand All @@ -165,7 +165,7 @@ describe('Formatter', () => {
messages: [
{
...message1,
message: 'message a b c'
message: 'message a b c d e'
}
],
errorCount: expect.any(Number),
Expand Down

0 comments on commit 4dd4987

Please sign in to comment.