diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-08-12 19:15:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 19:15:31 +0200 |
commit | 7d55e05486183fe3dbeccc7beaa46fa497f05e08 (patch) | |
tree | 372582a750545a417b673527927bf72f4def712f | |
parent | fd945755760a1ab9fb4e8a8e40131c51bb3c712e (diff) |
fix(lint): add links to help at lint.deno.land (#11667)
-rw-r--r-- | cli/tools/lint.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs index 1d808ae7f..57fd643f0 100644 --- a/cli/tools/lint.rs +++ b/cli/tools/lint.rs @@ -127,6 +127,8 @@ pub fn print_rules_list(json: bool) { println!("Available rules:"); for rule in lint_rules { println!(" - {}", rule.code()); + println!(" help: https://lint.deno.land/#{}", rule.code()); + println!(); } } } @@ -231,6 +233,7 @@ impl LintReporter for PrettyLintReporter { format!("({}) {}", colors::gray(&d.code), d.message.clone()); let message = format_diagnostic( + &d.code, &pretty_message, &source_lines, d.range.clone(), @@ -266,6 +269,7 @@ impl LintReporter for PrettyLintReporter { } pub fn format_diagnostic( + diagnostic_code: &str, message_line: &str, source_lines: &[&str], range: deno_lint::diagnostic::Range, @@ -300,19 +304,23 @@ pub fn format_diagnostic( if let Some(hint) = maybe_hint { format!( - "{}\n{}\n at {}\n\n {} {}", + "{}\n{}\n at {}\n\n {} {}\n {} for further information visit https://lint.deno.land/#{}", message_line, lines.join("\n"), formatted_location, colors::gray("hint:"), hint, + colors::gray("help:"), + diagnostic_code, ) } else { format!( - "{}\n{}\n at {}", + "{}\n{}\n at {}\n\n {} for further information visit https://lint.deno.land/#{}", message_line, lines.join("\n"), - formatted_location + formatted_location, + colors::gray("help:"), + diagnostic_code, ) } } |