Skip to content

Commit 1b853c5

Browse files
committed
feat(linter/plugins): remove --js-plugins CLI option
1 parent a6ff6ac commit 1b853c5

File tree

11 files changed

+22
-76
lines changed

11 files changed

+22
-76
lines changed

apps/oxlint/src/command/lint.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ pub struct LintCommand {
5050
#[bpaf(switch, hide_usage)]
5151
pub type_aware: bool,
5252

53-
/// Enables JS plugins (experimental).
54-
#[bpaf(switch, hide)]
55-
pub js_plugins: bool,
56-
5753
#[bpaf(external)]
5854
pub inline_config_options: InlineConfigOptions,
5955

apps/oxlint/src/lint.rs

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

243251
if let Some(basic_config_file) = oxlintrc_for_print {

apps/oxlint/src/run.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,12 @@ fn lint_impl(load_plugin: JsLoadPluginCb, lint_file: JsLintFileCb) -> CliRunResu
8686

8787
command.handle_threads();
8888

89-
let external_linter = if command.js_plugins {
90-
// JS plugins are only supported on 64-bit little-endian platforms at present
91-
#[cfg(all(target_pointer_width = "64", target_endian = "little"))]
92-
{
93-
Some(super::js_plugins::create_external_linter(load_plugin, lint_file))
94-
}
95-
96-
#[cfg(not(all(target_pointer_width = "64", target_endian = "little")))]
97-
#[expect(clippy::print_stderr)]
98-
{
99-
let (_, _) = (load_plugin, lint_file);
100-
eprintln!(
101-
"ERROR: JS plugins are only supported on 64-bit little-endian platforms at present"
102-
);
103-
return CliRunResult::InvalidOptionConfig;
104-
}
105-
} else {
89+
// JS plugins are only supported on 64-bit little-endian platforms at present
90+
#[cfg(all(target_pointer_width = "64", target_endian = "little"))]
91+
let external_linter = Some(super::js_plugins::create_external_linter(load_plugin, lint_file));
92+
#[cfg(not(all(target_pointer_width = "64", target_endian = "little")))]
93+
let external_linter = {
94+
let (_, _) = (load_plugin, lint_file);
10695
None
10796
};
10897

apps/oxlint/test/e2e.test.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CLI_PATH = pathJoin(PACKAGE_ROOT_PATH, 'dist/cli.js');
88
// Options to pass to `testFixture`.
99
interface TestOptions {
1010
// Arguments to pass to the CLI.
11-
// Defaults to `['--js-plugins']`.
1211
args?: string[];
1312
// Name of the snapshot file.
1413
// Defaults to `output`.
@@ -24,7 +23,7 @@ interface TestOptions {
2423
* @param options - Options to customize the test (optional)
2524
*/
2625
async function testFixture(fixtureName: string, options?: TestOptions): Promise<void> {
27-
const args = options?.args ?? ['--js-plugins'];
26+
const args = options?.args ?? [];
2827

2928
await testFixtureWithCommand({
3029
command: 'node',
@@ -36,24 +35,16 @@ async function testFixture(fixtureName: string, options?: TestOptions): Promise<
3635
}
3736

3837
describe('oxlint CLI', () => {
39-
it('should lint a directory without errors without JS plugins enabled', async () => {
40-
await testFixture('built_in_no_errors', { args: [], snapshotName: 'plugins_disabled' });
38+
it('should lint a directory without errors', async () => {
39+
await testFixture('built_in_no_errors', { args: [] });
4140
});
4241

43-
it('should lint a directory with errors without JS plugins enabled', async () => {
44-
await testFixture('built_in_errors', { args: [], snapshotName: 'plugins_disabled' });
45-
});
46-
47-
it('should lint a directory without errors with JS plugins enabled', async () => {
48-
await testFixture('built_in_no_errors', { snapshotName: 'plugins_enabled' });
49-
});
50-
51-
it('should lint a directory with errors with JS plugins enabled', async () => {
52-
await testFixture('built_in_errors', { snapshotName: 'plugins_enabled' });
42+
it('should lint a directory with errors', async () => {
43+
await testFixture('built_in_errors', { args: [] });
5344
});
5445

5546
it('should load a custom plugin', async () => {
56-
await testFixture('basic_custom_plugin', { snapshotName: 'plugins_enabled' });
47+
await testFixture('basic_custom_plugin');
5748
});
5849

5950
it('should load a custom plugin with various import styles', async () => {
@@ -68,10 +59,6 @@ describe('oxlint CLI', () => {
6859
await testFixture('custom_plugin_via_overrides');
6960
});
7061

71-
it('should report an error if a custom plugin in config but JS plugins are not enabled', async () => {
72-
await testFixture('basic_custom_plugin', { args: [], snapshotName: 'plugins_disabled' });
73-
});
74-
7562
it('should report an error if a custom plugin is missing', async () => {
7663
await testFixture('missing_custom_plugin');
7764
});
@@ -171,7 +158,7 @@ describe('oxlint CLI', () => {
171158

172159
try {
173160
await testFixture('fixes', {
174-
args: ['--js-plugins', '--fix'],
161+
args: ['--fix'],
175162
snapshotName: 'fixes_enabled',
176163
async getExtraSnapshotData() {
177164
const codeAfter = await fs.readFile(fixtureFilePath, 'utf8');
File renamed without changes.

apps/oxlint/test/fixtures/basic_custom_plugin/plugins_disabled.snap.md

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

apps/oxlint/test/fixtures/built_in_errors/plugins_enabled.snap.md

Lines changed: 0 additions & 16 deletions
This file was deleted.
File renamed without changes.

apps/oxlint/test/fixtures/built_in_no_errors/plugins_enabled.snap.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)