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
2 changes: 1 addition & 1 deletion apps/oxlint/test/__snapshots__/e2e.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ exports[`oxlint CLI > should report an error if a a rule is not found within a c
exports[`oxlint CLI > should report an error if a custom plugin in config but JS plugins are not enabled 1`] = `
"Failed to parse configuration file.

x JS plugins are not supported without \`--experimental-js-plugins\` CLI option
x \`plugins\` config contains './test_plugin'. JS plugins are not supported without \`--experimental-js-plugins\` CLI option
"
`;

Expand Down
18 changes: 12 additions & 6 deletions crates/oxc_linter/src/config/config_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ impl ConfigStoreBuilder {
}

if !external_plugins.is_empty() {
let external_linter =
external_linter.ok_or(ConfigBuilderError::NoExternalLinterConfigured)?;
let Some(external_linter) = external_linter else {
#[expect(clippy::missing_panics_doc, reason = "infallible")]
let plugin_specifier = external_plugins.iter().next().unwrap().clone();
return Err(ConfigBuilderError::NoExternalLinterConfigured { plugin_specifier });
};

let resolver = Resolver::default();

Expand Down Expand Up @@ -573,7 +576,9 @@ pub enum ConfigBuilderError {
error: String,
},
ExternalRuleLookupError(ExternalRuleLookupError),
NoExternalLinterConfigured,
NoExternalLinterConfigured {
plugin_specifier: String,
},
}

impl Display for ConfigBuilderError {
Expand All @@ -597,9 +602,10 @@ impl Display for ConfigBuilderError {
write!(f, "Failed to load JS plugin: {plugin_specifier}\n {error}")?;
Ok(())
}
ConfigBuilderError::NoExternalLinterConfigured => {
f.write_str(
"JS plugins are not supported without `--experimental-js-plugins` CLI option",
ConfigBuilderError::NoExternalLinterConfigured { plugin_specifier } => {
write!(
f,
"`plugins` config contains '{plugin_specifier}'. JS plugins are not supported without `--experimental-js-plugins` CLI option",
)?;
Ok(())
}
Expand Down
Loading