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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/oxlint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ oxc_linter = { workspace = true }
oxc_span = { workspace = true }

bpaf = { workspace = true, features = ["autocomplete", "bright-color", "derive"] }
cow-utils = { workspace = true }
ignore = { workspace = true, features = ["simd-accel"] }
miette = { workspace = true }
rayon = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::{
time::Instant,
};

use cow_utils::CowUtils;
use ignore::gitignore::Gitignore;
use oxc_diagnostics::{DiagnosticService, GraphicalReportHandler};
use oxc_linter::{
Expand Down Expand Up @@ -209,7 +210,8 @@ impl Runner for LintRunner {
} else {
let path = if path.is_relative() { options.cwd().join(path) } else { path.clone() };
stdout.write_all(format!(
"The tsconfig file {path:?} does not exist, Please provide a valid tsconfig file.\n",
"The tsconfig file {:?} does not exist, Please provide a valid tsconfig file.\n",
path.to_string_lossy().cow_replace('\\', "/")
).as_bytes()).or_else(Self::check_for_writer_error).unwrap();
stdout.flush().unwrap();

Expand Down
11 changes: 5 additions & 6 deletions apps/oxlint/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use crate::cli::{lint_command, LintRunner};
#[cfg(test)]
use crate::runner::Runner;
#[cfg(test)]
use cow_utils::CowUtils;
#[cfg(test)]
use regex::Regex;
#[cfg(test)]
use std::{env, path::PathBuf};
Expand Down Expand Up @@ -78,10 +80,8 @@ impl Tester {

// do not output the current working directory, each machine has a different one
let cwd_string = current_cwd.to_str().unwrap();
#[allow(clippy::disallowed_methods)]
let cwd_string = cwd_string.replace('\\', "/");
#[allow(clippy::disallowed_methods)]
let output_string = output_string.replace(&cwd_string, "<cwd>");
let cwd_string = cwd_string.cow_replace('\\', "/").to_string(); // for windows
let output_string = output_string.cow_replace(&cwd_string, "<cwd>");

let full_args_list =
multiple_args.iter().map(|args| args.join(" ")).collect::<Vec<String>>().join(" ");
Expand All @@ -90,8 +90,7 @@ impl Tester {

// windows can not handle filenames with *
// allow replace instead of cow_replace. It only test
#[allow(clippy::disallowed_methods)]
let snapshot_file_name = snapshot_file_name.replace('*', "_");
let snapshot_file_name = snapshot_file_name.cow_replace('*', "_").to_string();
settings.bind(|| {
insta::assert_snapshot!(snapshot_file_name, output_string);
});
Expand Down