Skip to content

Commit

Permalink
Update dist
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Mar 27, 2024
1 parent 573a4b1 commit a89f091
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4,768 deletions.
8 changes: 4 additions & 4 deletions dist/hlint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ const HLINT_SEV_TO_GITHUB_SEV = {
Ignore: 'warning',
};
/**
* Use JSON escaping to turn messages with newlines and such into a single line.
* Use JSON escaping to turn convert literal newlines to Github Action-supported newlines.
*/
function escapeString(str, quote) {
const jsonEscaped = JSON.stringify(str).replace(/\n/g, ' ');
const jsonEscaped = JSON.stringify(str).replace(/\n/g, '%0A');
// Possibly drop the surrounding quotes
return quote ? jsonEscaped : jsonEscaped.slice(1, jsonEscaped.length - 1);
}
/**
* Combine the non-"poblemMatcher" fields of an "idea" into
* a single line as a human-readable message.
*
* Fields are visually separated by a box character (' ▫︎ ').
* Fields are visually separated by newlines.
*/
function getNiceMessage(idea) {
const prefixParts = [];
Expand All @@ -68,7 +68,7 @@ function getNiceMessage(idea) {
if (idea.note && idea.note.length) {
messageParts.push(`Note: ${idea.note.map(n => escapeString(n, false)).join(' ')}`);
}
const message = messageParts.join(' ▫︎ ');
const message = messageParts.join('%0A');
return [prefix, message].filter(Boolean).join(': ');
}
function toMatchableProblem(idea) {
Expand Down
Loading

0 comments on commit a89f091

Please sign in to comment.