Skip to content
Merged
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
16 changes: 7 additions & 9 deletions apps/oxlint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{ffi::OsStr, io::BufWriter};
use std::io::BufWriter;

pub use oxc_linter::{
ExternalLinter, ExternalLinterLintFileCb, ExternalLinterLoadPluginCb, LintFileResult,
Expand Down Expand Up @@ -29,16 +29,14 @@ pub fn lint(external_linter: Option<ExternalLinter>) -> CliRunResult {
init_tracing();
init_miette();

let mut args = std::env::args_os().peekable();

let args = match args.peek() {
Some(s) if s == OsStr::new("node") => args.skip(2),
_ => args.skip(1),
};
let mut args = std::env::args_os();
// If first arg is `node`, also skip script path (`node script.js ...`).
// Otherwise, just skip first arg (`oxlint ...`).
if args.next().is_some_and(|arg| arg == "node") {
args.next();
}
let args = args.collect::<Vec<_>>();

// SAFELY skip first two args (node + script.js)
// let cli_args = std::env::args_os().skip(2);
let cmd = crate::cli::lint_command();
let command = match cmd.run_inner(&*args) {
Ok(cmd) => cmd,
Expand Down
Loading