Skip to content

feat(linter): Add --list-files to linter#17233

Open
wagenet wants to merge 5 commits intooxc-project:mainfrom
wagenet:list-files
Open

feat(linter): Add --list-files to linter#17233
wagenet wants to merge 5 commits intooxc-project:mainfrom
wagenet:list-files

Conversation

@wagenet
Copy link
Copy Markdown
Contributor

@wagenet wagenet commented Dec 21, 2025

Allows listing of all matched files without actually linting.

Fix #13172.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI labels Dec 21, 2025
Comment thread apps/oxlint/src/lint.rs Outdated
@wagenet wagenet marked this pull request as ready for review December 22, 2025 00:29
@wagenet wagenet requested a review from camc314 as a code owner December 22, 2025 00:29
Copilot AI review requested due to automatic review settings December 22, 2025 00:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a --list-files flag to the linter that allows users to see which files would be linted without actually performing the linting operation.

  • Adds --list-files command-line option
  • Implements file listing logic that displays matched files in sorted order and exits early
  • Includes test coverage for the new functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/oxlint/src/command/lint.rs Adds the list_files boolean field to LintCommand and includes a unit test
apps/oxlint/src/lint.rs Implements the file listing logic and adds integration test
apps/oxlint/src/snapshots/_--list-files [email protected] Snapshot test output for the --list-files feature
tasks/website_linter/src/snapshots/cli.snap Updates help text documentation with the new flag
tasks/website_linter/src/snapshots/cli_terminal.snap Updates terminal help output with the new flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@connorshea connorshea changed the title (feat): Add --list-files to linter feat(linter): Add --list-files to linter Dec 24, 2025
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Dec 24, 2025
wagenet and others added 2 commits December 30, 2025 21:37
The parallel file walker returns files in non-deterministic order.
Sort the output for consistent, predictable results.

Also update CLI help snapshots that were missing from initial commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…iles with the command.

And ensure that there's a snapshot of the output with no-ignore as well.

Generated with help from Copilot + Raptor mini.
Copy link
Copy Markdown
Member

@connorshea connorshea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a few commits to add more tests and have exercised the command on the mastodon repo. This looks like it works correctly to me, should be good to go :)

Thank you for the contribution!

Comment thread apps/oxlint/src/lint.rs
@@ -369,6 +357,17 @@ impl CliRunner {
.filter(|path| !ignore_matcher.should_ignore(Path::new(path)))
.collect::<Vec<Arc<OsStr>>>();

if self.options.list_files {
let mut sorted_files: Vec<_> = files_to_lint.iter().collect();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious here, could we just use sort_unstable() here instead of copying and then sorting or are we worried about preserving the files_to_lint ordering?

@dosmond
Copy link
Copy Markdown
Contributor

dosmond commented Mar 2, 2026

Following this from #19833

Just wondering if there are plans to merge this! This would be great to have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: print out all the files being linted

5 participants