From cb5cb6287e098ccd9acd4a7398bad5bee1e299d4 Mon Sep 17 00:00:00 2001 From: Boshen <1430279+Boshen@users.noreply.github.com> Date: Sat, 26 Oct 2024 08:59:12 +0000 Subject: [PATCH] fix(linter): eprintln unmatched rules warning (#6916) We can make this a hard error and bail early once stable. --- crates/oxc_linter/src/config/rules.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/oxc_linter/src/config/rules.rs b/crates/oxc_linter/src/config/rules.rs index f0f07a36c..64c308e94 100644 --- a/crates/oxc_linter/src/config/rules.rs +++ b/crates/oxc_linter/src/config/rules.rs @@ -59,7 +59,7 @@ impl IntoIterator for OxlintRules { } impl OxlintRules { - #[allow(clippy::option_if_let_else, clippy::print_stdout)] + #[allow(clippy::option_if_let_else, clippy::print_stderr)] pub(crate) fn override_rules(&self, rules_for_override: &mut RuleSet, all_rules: &[RuleEnum]) { use itertools::Itertools; let mut rules_to_replace: Vec = vec![]; @@ -134,10 +134,11 @@ impl OxlintRules { } if !rules_not_matched.is_empty() { - println!("The following rules do not match the currently supported rules:"); - for rule in rules_not_matched { - println!("{rule}"); - } + let rules = rules_not_matched.join("\n"); + let error = Error::from(OxcDiagnostic::warn(format!( + "The following rules do not match the currently supported rules:\n{rules}" + ))); + eprintln!("{error:?}"); } } }