fix(linter): output LintCommandInfo for CliRunResult::LintNoFilesFound (#8714)

In the older version we outputted the found warnings and errors (which also be zero).
This is only reimplementing a part of the old behavior ands skips the old output here:
4a2f2a9cd9/apps/oxlint/src/output_formatter/default.rs (L84-L110)

Bug found here:
659c225c56/apps/oxlint/src/snapshots/_--ignore-path%20fixtures__linter__.customignore%20fixtures__linter__nan.js%40oxlint.snap
This commit is contained in:
Sysix 2025-01-31 11:48:23 +00:00
parent 18f1b15651
commit e929f26826
4 changed files with 13 additions and 0 deletions

View file

@ -147,6 +147,16 @@ impl Runner for LintRunner {
// If explicit paths were provided, but all have been
// filtered, return early.
if provided_path_count > 0 {
if let Some(end) = output_formatter.lint_command_info(&LintCommandInfo {
number_of_files: 0,
number_of_rules: 0,
threads_count: rayon::current_num_threads(),
start_time: now.elapsed(),
}) {
stdout.write_all(end.as_bytes()).or_else(Self::check_for_writer_error).unwrap();
stdout.flush().unwrap();
};
return CliRunResult::LintNoFilesFound;
}

View file

@ -5,6 +5,7 @@ source: apps/oxlint/src/tester.rs
arguments: --ignore-path fixtures/issue_7566/.oxlintignore fixtures/issue_7566/tests/main.js fixtures/issue_7566/tests/function/main.js
working directory:
----------
Finished in <variable>ms on 0 files with 0 rules using 1 threads.
----------
CLI result: LintNoFilesFound
----------

View file

@ -5,6 +5,7 @@ source: apps/oxlint/src/tester.rs
arguments: --ignore-path fixtures/linter/.customignore fixtures/linter/nan.js
working directory:
----------
Finished in <variable>ms on 0 files with 0 rules using 1 threads.
----------
CLI result: LintNoFilesFound
----------

View file

@ -5,6 +5,7 @@ source: apps/oxlint/src/tester.rs
arguments: -c fixtures/config_ignore_patterns/ignore_extension/eslintrc.json fixtures/config_ignore_patterns/ignore_extension/main.js
working directory:
----------
Finished in <variable>ms on 0 files with 0 rules using 1 threads.
----------
CLI result: LintNoFilesFound
----------