|
10 | 10 | import { deleteUndefinedValues } from "./cleaners.js"; |
11 | 11 | import { EMOJI_FAIL, EMOJI_WARNING } from "./constants.js"; |
12 | 12 | import { unfence } from "./unwrappers.js"; |
13 | | -import type { Diagnostic } from "./types.js"; |
| 13 | +import type { Diagnostic, DiagnosticSeverity } from "./types.js"; |
14 | 14 |
|
15 | 15 | // Regular expression for matching GitHub Actions annotations. |
16 | 16 | // Example: ::error file=foo.js,line=10,endLine=11::Something went wrong. |
@@ -39,7 +39,7 @@ const GITHUB_MARKDOWN_WARNINGS_RX = |
39 | 39 | // Example: src/connection.ts(71,5): error TS1128: Declaration or statement expected. |
40 | 40 | // src/connection.ts(71,5): error TS1128: Declaration or statement expected. |
41 | 41 | const TYPESCRIPT_PARENTHESES_ANNOTATIONS_RX = |
42 | | - /^(?<file>[^\(\n]+)\((?<line>\d+),(?<col>\d+)\):\s+(?<severity>error|warning)\s+(?<code>TS\d+):\s+(?<message>.+)$/gim; |
| 42 | + /^(?<file>[^(\n]+)\((?<line>\d+),(?<col>\d+)\):\s+(?<severity>error|warning)\s+(?<code>TS\d+):\s+(?<message>.+)$/gim; |
43 | 43 | const ANNOTATIONS_RX = [ |
44 | 44 | TYPESCRIPT_PARENTHESES_ANNOTATIONS_RX, |
45 | 45 | TYPESCRIPT_ANNOTATIONS_RX, |
@@ -187,6 +187,7 @@ export function convertGithubMarkdownAnnotationsToItems(text: string) { |
187 | 187 | * @returns A formatted string representing the Diagnostic as a list item. |
188 | 188 | */ |
189 | 189 | export function convertAnnotationToItem(d: Diagnostic) { |
| 190 | + // eslint-disable-next-line @typescript-eslint/no-unused-vars |
190 | 191 | const { severity, message, filename, code, range } = d; |
191 | 192 | const line = range?.[0]?.[0]; |
192 | 193 | return `- ${SEV_EMOJI_MAP[severity?.toLowerCase()] ?? "info"} ${message}${filename ? ` (\`${filename}${line ? `#L${line}` : ""}\`)` : ""}`; |
|
0 commit comments