Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ impl LintRunner {
}
.with_filters(&filters);

// If no external rules, discard `ExternalLinter`
let mut external_linter = self.external_linter;
if external_plugin_store.is_empty() {
external_linter = None;
}

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 {
Expand Down Expand Up @@ -324,7 +330,7 @@ impl LintRunner {
}
}

let linter = Linter::new(LintOptions::default(), config_store, self.external_linter)
let linter = Linter::new(LintOptions::default(), config_store, external_linter)
.with_fix(fix_options.fix_kind())
.with_report_unused_directives(report_unused_directives);

Expand Down
5 changes: 5 additions & 0 deletions crates/oxc_linter/src/external_plugin_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ pub struct ExternalPluginStore {
}

impl ExternalPluginStore {
/// Returns `true` if no external plugins have been loaded.
pub fn is_empty(&self) -> bool {
self.plugins.is_empty()
}

pub fn is_plugin_registered(&self, plugin_path: &str) -> bool {
self.registered_plugin_paths.contains(plugin_path)
}
Expand Down
Loading