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
1 change: 1 addition & 0 deletions apps/oxlint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ default = []
allocator = ["dep:mimalloc-safe"]
oxlint2 = ["oxc_linter/oxlint2"]
disable_oxlint2 = ["oxc_linter/disable_oxlint2"]
force_test_reporter = ["oxc_linter/force_test_reporter"]
6 changes: 5 additions & 1 deletion apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ impl Runner for LintRunner {
let paths = walker.paths();
let number_of_files = paths.len();

let handler = GraphicalReportHandler::new();
let handler = if cfg!(any(test, feature = "force_test_reporter")) {
GraphicalReportHandler::new_themed(miette::GraphicalTheme::none())
} else {
GraphicalReportHandler::new()
};

let search_for_nested_configs = !disable_nested_config &&
// If the `--config` option is explicitly passed, we should not search for nested config files
Expand Down
6 changes: 3 additions & 3 deletions apps/oxlint/src/output_formatter/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ impl InternalFormatter for DefaultOutputFormatter {
}
}

#[cfg(not(test))]
#[cfg(not(any(test, feature = "force_test_reporter")))]
fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
Box::new(GraphicalReporter::default())
}

#[cfg(test)]
#[cfg(any(test, feature = "force_test_reporter"))]
fn get_diagnostic_reporter(&self) -> Box<dyn DiagnosticReporter> {
use crate::output_formatter::default::test_implementation::GraphicalReporterTester;

Expand Down Expand Up @@ -113,7 +113,7 @@ fn get_diagnostic_result_output(result: &DiagnosticResult) -> String {
output
}

#[cfg(test)]
#[cfg(any(test, feature = "force_test_reporter"))]
mod test_implementation {
use oxc_diagnostics::{
Error, GraphicalReportHandler, GraphicalTheme,
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ruledocs = ["oxc_macros/ruledocs"] # Enables the `ruledocs` feature for conditio
language_server = ["oxc_data_structures/rope"] # For the Runtime to support needed information for the language server
oxlint2 = []
disable_oxlint2 = []
force_test_reporter = []

[lints]
workspace = true
Expand Down
1 change: 1 addition & 0 deletions napi/oxlint2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ napi-build = { workspace = true }

[features]
default = []
force_test_reporter = ["oxlint/force_test_reporter"]
2 changes: 1 addition & 1 deletion napi/oxlint2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"build-dev": "napi build --platform --js ./bindings.js --dts ./bindings.d.ts --output-dir src --no-dts-cache --esm",
"build-test": "pnpm run build-dev --release",
"build-test": "pnpm run build-dev --release --features force_test_reporter",
"build": "pnpm run build-dev --release",
"test": "vitest"
},
Expand Down
Loading