Skip to content

Commit

Permalink
feat(oxlint): add cwd property to LintRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Nov 19, 2024
1 parent e162095 commit 5df79c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ impl Runner for LintRunner {
}

impl LintRunner {
#[must_use]
pub fn with_cwd(mut self, cwd: PathBuf) -> Self {
self.cwd = cwd;
self
Expand Down Expand Up @@ -244,7 +245,7 @@ impl LintRunner {

#[cfg(all(test, not(target_os = "windows")))]
mod test {
use std::{env, path::PathBuf};
use std::env;

use super::LintRunner;
use crate::cli::{lint_command, CliRunResult, LintResult, Runner};
Expand All @@ -267,7 +268,7 @@ mod test {
let mut current_cwd = env::current_dir().unwrap();
current_cwd.push(cwd);

match LintRunner::new(options).with_cwd(PathBuf::from(current_cwd)).run() {
match LintRunner::new(options).with_cwd(current_cwd).run() {
CliRunResult::LintResult(lint_result) => lint_result,
other => panic!("{other:?}"),
}
Expand Down

0 comments on commit 5df79c7

Please sign in to comment.