Skip to content

Commit

Permalink
fix(linter): revert unmatched rule error (#7257)
Browse files Browse the repository at this point in the history
- related to #6988

This is causing a lot of errors currently such as
#7233. I think we need to
handle rule names more robustly first:

- #7240
- #7082
- #7242

then, I think we can revisit this and maybe implement it as an actual
lint plugin too? #7086
  • Loading branch information
camchenry authored and Dunqing committed Nov 18, 2024
1 parent 0ddbbf4 commit e93cc66
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 e93cc66

Please sign in to comment.