diff --git a/.changeset/tricky-news-float.md b/.changeset/tricky-news-float.md new file mode 100644 index 0000000..2be284c --- /dev/null +++ b/.changeset/tricky-news-float.md @@ -0,0 +1,5 @@ +--- +'@steiger/pretty-reporter': patch +--- + +Prevent links to rule descriptions being broken in some terminals diff --git a/packages/pretty-reporter/src/format-single-diagnostic.ts b/packages/pretty-reporter/src/format-single-diagnostic.ts index 32b1469..4c37dc0 100644 --- a/packages/pretty-reporter/src/format-single-diagnostic.ts +++ b/packages/pretty-reporter/src/format-single-diagnostic.ts @@ -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}