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
7 changes: 4 additions & 3 deletions crates/oxc_linter/src/config/config_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ impl ConfigStoreBuilder {
}
}

// If external plugins are not enabled (language server), then skip loading JS plugins.
// This is so that a project can use JS plugins via `oxlint` CLI, and language server
// will just silently ignore them - rather than crashing.
// Only attempt to load external JS plugins when external plugins are enabled,
// i.e., when the external JS linter is available/initialized. If the store is
// disabled, configs that reference external plugins are accepted but the plugins
// themselves are not loaded, to avoid failing config parsing.
if !external_plugins.is_empty() && external_plugin_store.is_enabled() {
let Some(external_linter) = external_linter else {
#[expect(clippy::missing_panics_doc, reason = "infallible")]
Expand Down
9 changes: 2 additions & 7 deletions crates/oxc_linter/src/config/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,8 @@ impl OxlintRules {
});
}
} else {
// If JS plugins are disabled (language server), assume plugin name refers to a JS plugin,
// and that rule name is valid for that plugin.
// But language server doesn't support JS plugins, so ignore the rule.
//
// This unfortunately means we can't catch genuinely invalid plugin names in language server
// (e.g. typos like `unicon/filename-case`). But we can't avoid this as the name of a JS plugin
// can only be known by loading it, which language server can't do at present.
// Plugin name is not a built-in plugin. If external plugins are enabled,
// try to resolve it as an external JS plugin; otherwise ignore it.
if external_plugin_store.is_enabled() {
match external_plugin_store.lookup_rule_id(plugin_name, rule_name) {
Ok(external_rule_id) => {
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_linter/src/external_plugin_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub struct ExternalPluginStore {
/// The rule ID is also stored, so that can merge options with the rule's default options on JS side.
options: IndexVec<ExternalOptionsId, (ExternalRuleId, SmallVec<[serde_json::Value; 1]>)>,

/// `true` for `oxlint`, `false` for language server
is_enabled: bool,
}

Expand Down
Loading