Skip to content

Commit

Permalink
Prevent links to rule descriptions being broken in some terminals (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
illright authored Jan 3, 2025
1 parent 80d9f46 commit 5c0225f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tricky-news-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@steiger/pretty-reporter': patch
---

Prevent links to rule descriptions being broken in some terminals
6 changes: 5 additions & 1 deletion packages/pretty-reporter/src/format-single-diagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export function formatSingleDiagnostic(d: Diagnostic, cwd: string): string {
const message = pc.reset(d.message)
const autofixable = d.fixes !== undefined && d.fixes.length > 0 ? pc.green(`${figures.tick} Auto-fixable`) : null
const location = pc.underline(formatLocation(d.location, cwd))
const ruleName = pc.blue(terminalLink(d.ruleName, d.getRuleDescriptionUrl(d.ruleName).toString()))
const ruleName = pc.blue(
terminalLink(d.ruleName, d.getRuleDescriptionUrl(d.ruleName).toString(), {
fallback: (text, url) => `${pc.reset(text)}: ${pc.blue(url)}`,
}),
)

return `
${s} ${location}
Expand Down

0 comments on commit 5c0225f

Please sign in to comment.