Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Jan 12, 2025
1 parent eaffa6e commit 9cbeeb6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/oxlint/src/command/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub struct BasicOptions {
#[bpaf(argument("./tsconfig.json"), hide_usage)]
pub tsconfig: Option<PathBuf>,

/// Initialize oxlint configuration with default values
/// Initialize oxlint configuration with default values
#[bpaf(switch, hide_usage)]
pub init: bool,
}
Expand Down
30 changes: 19 additions & 11 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::{
env, fs, io::BufWriter, path::{Path, PathBuf}, time::Instant
env, fs,
io::BufWriter,
path::{Path, PathBuf},
time::Instant,
};

use ignore::gitignore::Gitignore;
Expand Down Expand Up @@ -115,24 +118,29 @@ impl Runner for LintRunner {

enable_plugins.apply_overrides(&mut oxlintrc.plugins);

let oxlintrc_for_print =
if misc_options.print_config || basic_options.init { Some(oxlintrc.clone()) } else { None };
let oxlintrc_for_print = if misc_options.print_config || basic_options.init {
Some(oxlintrc.clone())
} else {
None
};
let config_builder =
ConfigStoreBuilder::from_oxlintrc(false, oxlintrc).with_filters(filter);

if let Some(basic_config_file) = oxlintrc_for_print {
let config_file = config_builder.resolve_final_config_file(basic_config_file);
if misc_options.print_config {
return CliRunResult::PrintConfigResult {
config_file,
};
return CliRunResult::PrintConfigResult { config_file };
} else if basic_options.init {
match fs::write(Self::DEFAULT_OXLINTRC, config_file) {
Ok(()) => return CliRunResult::ConfigFileInitResult {
message: "Configuration file created".to_string(),
},
Err(_) => return CliRunResult::ConfigFileInitResult {
message: "Failed to create configuration file".to_string(),
Ok(()) => {
return CliRunResult::ConfigFileInitResult {
message: "Configuration file created".to_string(),
}
}
Err(_) => {
return CliRunResult::ConfigFileInitResult {
message: "Failed to create configuration file".to_string(),
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/oxlint/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Termination for CliRunResult {
Self::PrintConfigResult { config_file } => {
println!("{config_file}");
ExitCode::from(0)
},
}
Self::ConfigFileInitResult { message } => {
println!("{message}");
ExitCode::from(0)
Expand Down

0 comments on commit 9cbeeb6

Please sign in to comment.