Skip to content

Commit 03d1684

Browse files
committed
fix(linter/plugins): output warning on first JS plugin load (#14165)
Oxlint outputs a warning "JS plugins are experimental" when there's a config containing `jsPlugins`. Output this warning before trying to load the first plugin, so that you still get the warning even if there's an error loading it. The warning may be particularly relevant in this case!
1 parent 9716f7c commit 03d1684

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

apps/oxlint/src/lint.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,6 @@ impl CliRunner {
238238
let mut external_linter = self.external_linter;
239239
if external_plugin_store.is_empty() {
240240
external_linter = None;
241-
} else {
242-
#[expect(clippy::print_stderr)]
243-
{
244-
eprintln!(
245-
"WARNING: JS plugins are experimental and not subject to semver.\nBreaking changes are possible while JS plugins support is under development."
246-
);
247-
}
248241
}
249242

250243
if let Some(basic_config_file) = oxlintrc_for_print {

apps/oxlint/test/fixtures/custom_plugin_import_error/output.snap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ Failed to parse configuration file.
1212

1313
# stderr
1414
```
15+
WARNING: JS plugins are experimental and not subject to semver.
16+
Breaking changes are possible while JS plugins support is under development.
1517
```

apps/oxlint/test/fixtures/custom_plugin_lint_createOnce_error/output.snap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ Failed to parse configuration file.
1212

1313
# stderr
1414
```
15+
WARNING: JS plugins are experimental and not subject to semver.
16+
Breaking changes are possible while JS plugins support is under development.
1517
```

apps/oxlint/test/fixtures/custom_plugin_missing_rule/output.snap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ Failed to parse configuration file.
1010

1111
# stderr
1212
```
13+
WARNING: JS plugins are experimental and not subject to semver.
14+
Breaking changes are possible while JS plugins support is under development.
1315
```

apps/oxlint/test/fixtures/custom_plugin_via_overrides_missing_rule/output.snap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ Failed to build configuration.
1010

1111
# stderr
1212
```
13+
WARNING: JS plugins are experimental and not subject to semver.
14+
Breaking changes are possible while JS plugins support is under development.
1315
```

apps/oxlint/test/fixtures/missing_custom_plugin/output.snap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ Failed to parse configuration file.
1111

1212
# stderr
1313
```
14+
WARNING: JS plugins are experimental and not subject to semver.
15+
Breaking changes are possible while JS plugins support is under development.
1416
```

crates/oxc_linter/src/config/config_builder.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,14 @@ impl ConfigStoreBuilder {
499499
) -> Result<(), ConfigBuilderError> {
500500
use crate::PluginLoadResult;
501501

502+
// Print warning on 1st attempt to load a plugin
503+
#[expect(clippy::print_stderr)]
504+
if external_plugin_store.is_empty() {
505+
eprintln!(
506+
"WARNING: JS plugins are experimental and not subject to semver.\nBreaking changes are possible while JS plugins support is under development."
507+
);
508+
}
509+
502510
let resolved = resolver.resolve(oxlintrc_dir_path, plugin_specifier).map_err(|e| {
503511
ConfigBuilderError::PluginLoadFailed {
504512
plugin_specifier: plugin_specifier.to_string(),

0 commit comments

Comments
 (0)