Skip to content

Commit daf9e3e

Browse files
committed
fix(output): print notes to stderr
A note explains the situation around a command rather than being part of its result, so piping stdout to a file or a parser should not pick it up. Every current caller is prose for a human: `vp check`'s "Format skipped", the dlx yarn@1 fallback, "Version will be downloaded on first use", "Restart your terminal to apply shell changes". This is also what `rfcs/cli-output-polish.md` specified for `note` in both Rust and TypeScript; the implementation used `println!` instead.
1 parent a24eede commit daf9e3e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎crates/vite_shared/src/output.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ pub fn error(msg: &str) {
6767
eprintln!("{} {msg}", "error:".red().bold());
6868
}
6969

70-
/// Print a note message to stdout (supplementary info).
71-
#[expect(clippy::print_stdout, clippy::print_stderr, clippy::disallowed_macros)]
70+
/// Print a note message to stderr (supplementary info).
71+
///
72+
/// A note explains the situation around a command rather than being part of
73+
/// its result, so it belongs on the diagnostic stream: piping stdout to a file
74+
/// or a parser keeps the command's own output intact.
75+
#[expect(clippy::print_stderr, clippy::disallowed_macros)]
7276
pub fn note(msg: &str) {
73-
if user_output_to_stderr() {
74-
eprintln!("{} {msg}", "note:".dimmed().bold());
75-
} else {
76-
println!("{} {msg}", "note:".dimmed().bold());
77-
}
77+
eprintln!("{} {msg}", "note:".dimmed().bold());
7878
}
7979

8080
/// Print a success line with checkmark to stdout.

0 commit comments

Comments
 (0)