Skip to content

Commit 5422bc8

Browse files
committed
refactor(linter/plugins): remove disable_oxlint2 Cargo feature
1 parent 0444abf commit 5422bc8

File tree

9 files changed

+18
-21
lines changed

9 files changed

+18
-21
lines changed

apps/oxlint/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ lazy-regex = { workspace = true }
6262
default = []
6363
allocator = ["dep:mimalloc-safe"]
6464
oxlint2 = ["oxc_linter/oxlint2", "oxc_allocator/fixed_size", "dep:simdutf8"]
65-
disable_oxlint2 = ["oxc_linter/disable_oxlint2"]
6665
force_test_reporter = ["oxc_linter/force_test_reporter"]

apps/oxlint/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub mod cli {
1818

1919
use cli::{CliRunResult, LintRunner};
2020

21-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
21+
#[cfg(feature = "oxlint2")]
2222
mod raw_fs;
2323

2424
#[cfg(all(feature = "allocator", not(miri), not(target_family = "wasm")))]

apps/oxlint/src/lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,15 @@ impl LintRunner {
359359

360360
// Spawn linting in another thread so diagnostics can be printed immediately from diagnostic_service.run.
361361
rayon::spawn(move || {
362-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
362+
#[cfg(feature = "oxlint2")]
363363
let has_external_linter = linter.has_external_linter();
364364

365365
let mut lint_service = LintService::new(linter, options);
366366
lint_service.with_paths(files_to_lint);
367367

368368
// Use `RawTransferFileSystem` if `oxlint2` feature is enabled and `ExternalLinter` exists.
369369
// This reads the source text into start of allocator, instead of the end.
370-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
370+
#[cfg(feature = "oxlint2")]
371371
if has_external_linter {
372372
use crate::raw_fs::RawTransferFileSystem;
373373
lint_service.with_file_system(Box::new(RawTransferFileSystem));

crates/oxc_linter/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ default = []
1818
ruledocs = ["oxc_macros/ruledocs"] # Enables the `ruledocs` feature for conditional compilation
1919
language_server = ["oxc_data_structures/rope"] # For the Runtime to support needed information for the language server
2020
oxlint2 = ["dep:oxc_ast_macros", "oxc_allocator/fixed_size", "oxc_ast_visit/serialize", "tokio/rt-multi-thread"]
21-
disable_oxlint2 = []
2221
force_test_reporter = []
2322

2423
[lints]

crates/oxc_linter/src/config/config_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl ConfigStoreBuilder {
494494
serde_json::to_string_pretty(&oxlintrc).unwrap()
495495
}
496496

497-
#[cfg(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))))]
497+
#[cfg(not(feature = "oxlint2"))]
498498
#[expect(unused_variables, clippy::needless_pass_by_ref_mut)]
499499
fn load_external_plugin(
500500
oxlintrc_dir_path: &Path,
@@ -506,7 +506,7 @@ impl ConfigStoreBuilder {
506506
unreachable!()
507507
}
508508

509-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
509+
#[cfg(feature = "oxlint2")]
510510
fn load_external_plugin(
511511
oxlintrc_dir_path: &Path,
512512
plugin_specifier: &str,

crates/oxc_linter/src/config/config_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl ConfigStore {
343343
None
344344
}
345345

346-
#[cfg_attr(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))), expect(dead_code))]
346+
#[cfg_attr(not(feature = "oxlint2"), expect(dead_code))]
347347
pub(crate) fn resolve_plugin_rule_names(
348348
&self,
349349
external_rule_id: ExternalRuleId,

crates/oxc_linter/src/external_linter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct Loc {
4747
}
4848

4949
#[derive(Clone)]
50-
#[cfg_attr(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))), expect(dead_code))]
50+
#[cfg_attr(not(feature = "oxlint2"), expect(dead_code))]
5151
pub struct ExternalLinter {
5252
pub(crate) load_plugin: ExternalLinterLoadPluginCb,
5353
pub(crate) lint_file: ExternalLinterLintFileCb,

crates/oxc_linter/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use oxc_ast::ast_kind::AST_TYPE_MAX;
88
use oxc_data_structures::box_macros::boxed_array;
99
use oxc_semantic::AstNode;
1010

11-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
11+
#[cfg(feature = "oxlint2")]
1212
use oxc_ast_macros::ast;
13-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
13+
#[cfg(feature = "oxlint2")]
1414
use oxc_ast_visit::utf8_to_utf16::Utf8ToUtf16;
1515

1616
#[cfg(test)]
@@ -40,8 +40,7 @@ pub mod rules;
4040
pub mod table;
4141

4242
mod generated {
43-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
44-
#[cfg(debug_assertions)]
43+
#[cfg(all(feature = "oxlint2", debug_assertions))]
4544
mod assert_layouts;
4645
mod rule_runner_impls;
4746
}
@@ -260,11 +259,11 @@ impl Linter {
260259
}
261260
}
262261

263-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
262+
#[cfg(feature = "oxlint2")]
264263
self.run_external_rules(&external_rules, path, &mut ctx_host, allocator);
265264

266265
// Stop clippy complaining about unused vars
267-
#[cfg(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))))]
266+
#[cfg(not(feature = "oxlint2"))]
268267
let (_, _, _) = (&external_rules, &mut ctx_host, allocator);
269268

270269
if let Some(severity) = self.options.report_unused_directive {
@@ -282,7 +281,7 @@ impl Linter {
282281
ctx_host.take_diagnostics()
283282
}
284283

285-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
284+
#[cfg(feature = "oxlint2")]
286285
fn run_external_rules<'a>(
287286
&self,
288287
external_rules: &[(ExternalRuleId, AllowWarnDeny)],
@@ -400,7 +399,7 @@ impl Linter {
400399
}
401400
}
402401

403-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
402+
#[cfg(feature = "oxlint2")]
404403
/// Metadata written to end of buffer.
405404
///
406405
/// Duplicate of `RawTransferMetadata` in `napi/parser/src/raw_transfer_types.rs`.
@@ -418,10 +417,10 @@ struct RawTransferMetadata2 {
418417
pub(crate) _padding: u64,
419418
}
420419

421-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
420+
#[cfg(feature = "oxlint2")]
422421
use RawTransferMetadata2 as RawTransferMetadata;
423422

424-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
423+
#[cfg(feature = "oxlint2")]
425424
impl RawTransferMetadata {
426425
pub fn new(data_offset: u32) -> Self {
427426
Self { data_offset, is_ts: false, _padding: 0 }

crates/oxc_linter/src/service/runtime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,11 @@ impl Runtime {
269269
// If an external linter is used (JS plugins), we must use fixed-size allocators,
270270
// for compatibility with raw transfer
271271
let allocator_pool = if linter.has_external_linter() {
272-
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
272+
#[cfg(feature = "oxlint2")]
273273
{
274274
AllocatorPool::new_fixed_size(thread_count)
275275
}
276-
#[cfg(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))))]
276+
#[cfg(not(feature = "oxlint2"))]
277277
{
278278
panic!("`oxlint2` feature must be enabled when using external linters");
279279
}

0 commit comments

Comments
 (0)