Skip to content

Commit

Permalink
fix(linter): revert unmatched rule error
Browse files Browse the repository at this point in the history
  • Loading branch information
camchenry committed Nov 12, 2024
1 parent c4ed230 commit be47d56
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
3 changes: 0 additions & 3 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ mod test {
let options = lint_command().run_inner(new_args.as_slice()).unwrap();
match LintRunner::new(options).run() {
CliRunResult::LintResult(lint_result) => lint_result,
CliRunResult::LintError { error } => {
panic!("{error}")
}
other => panic!("{other:?}"),
}
}
Expand Down
21 changes: 3 additions & 18 deletions apps/oxlint/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,10 @@ use std::{
#[derive(Debug)]
pub enum CliRunResult {
None,
InvalidOptions {
message: String,
},
PathNotFound {
paths: Vec<PathBuf>,
},
/// Indicates that there was an error trying to run the linter and it was
/// not able to complete linting successfully.
LintError {
error: String,
},
InvalidOptions { message: String },
PathNotFound { paths: Vec<PathBuf> },
LintResult(LintResult),
PrintConfigResult {
config_file: String,
},
PrintConfigResult { config_file: String },
}

/// A summary of a complete linter run.
Expand Down Expand Up @@ -58,10 +47,6 @@ impl Termination for CliRunResult {
println!("Path {paths:?} does not exist.");
ExitCode::from(1)
}
Self::LintError { error } => {
eprintln!("Error: {error}");
ExitCode::from(1)
}
Self::LintResult(LintResult {
duration,
number_of_rules,
Expand Down
15 changes: 0 additions & 15 deletions crates/oxc_linter/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{
fmt,
};

use oxc_diagnostics::{Error, OxcDiagnostic};
use oxc_span::CompactStr;
use rustc_hash::FxHashSet;

Expand Down Expand Up @@ -102,20 +101,6 @@ impl LinterBuilder {
oxlintrc_rules.override_rules(&mut builder.rules, all_rules.as_slice());
}

#[expect(clippy::print_stderr)]
if !oxlintrc_rules.unknown_rules.is_empty() {
let rules = oxlintrc_rules
.unknown_rules
.iter()
.map(|r| r.full_name())
.collect::<Vec<_>>()
.join("\n");
let error = Error::from(OxcDiagnostic::warn(format!(
"The following rules do not match the currently supported rules:\n{rules}"
)));
eprintln!("{error:?}");
}

builder
}

Expand Down

0 comments on commit be47d56

Please sign in to comment.