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
5 changes: 2 additions & 3 deletions apps/oxlint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ mod command;
mod lint;
mod output_formatter;
mod result;
mod runner;
mod tester;
mod walk;

pub mod cli {
pub use crate::{command::*, lint::LintRunner, result::CliRunResult, runner::Runner};
pub use crate::{command::*, lint::LintRunner, result::CliRunResult};
}

pub use oxc_linter::{
Expand All @@ -21,7 +20,7 @@ mod raw_fs;
#[global_allocator]
static GLOBAL: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc;

use cli::{CliRunResult, LintRunner, Runner};
use cli::{CliRunResult, LintRunner};
use std::{ffi::OsStr, io::BufWriter};

pub fn lint(external_linter: Option<ExternalLinter>) -> CliRunResult {
Expand Down
10 changes: 4 additions & 6 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
use serde_json::Value;

use crate::{
cli::{CliRunResult, LintCommand, MiscOptions, ReportUnusedDirectives, Runner, WarningOptions},
cli::{CliRunResult, LintCommand, MiscOptions, ReportUnusedDirectives, WarningOptions},
output_formatter::{LintCommandInfo, OutputFormatter},
walk::Walk,
};
Expand All @@ -32,18 +32,16 @@ pub struct LintRunner {
external_linter: Option<ExternalLinter>,
}

impl Runner for LintRunner {
type Options = LintCommand;

fn new(options: Self::Options, external_linter: Option<ExternalLinter>) -> Self {
impl LintRunner {
pub(crate) fn new(options: LintCommand, external_linter: Option<ExternalLinter>) -> Self {
Self {
options,
cwd: env::current_dir().expect("Failed to get current working directory"),
external_linter,
}
}

fn run(self, stdout: &mut dyn Write) -> CliRunResult {
pub(crate) fn run(self, stdout: &mut dyn Write) -> CliRunResult {
let format_str = self.options.output_options.format;
let output_formatter = OutputFormatter::new(format_str);

Expand Down
2 changes: 0 additions & 2 deletions apps/oxlint/src/tester.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#[cfg(test)]
use crate::cli::{LintRunner, lint_command};
#[cfg(test)]
use crate::runner::Runner;
#[cfg(test)]
use cow_utils::CowUtils;
#[cfg(test)]
use lazy_regex::Regex;
Expand Down
Loading