Skip to content

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

Closed
wagenet wants to merge 5 commits into
oxc-project:mainfrom
wagenet:list-files
Closed

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

Conversation

@wagenet

@wagenet wagenet commented Dec 21, 2025

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

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.

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 fixtures__linter@oxlint.snap 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 <noreply@anthropic.com>
…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.

@connorshea connorshea left a comment

Copy link
Copy Markdown
Member

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

dosmond commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Following this from #19833

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

@camchenry camchenry self-assigned this Apr 23, 2026
graphite-app Bot pushed a commit that referenced this pull request May 19, 2026
- supersedes #17233
- part of #19833

Adds a `--debug files` option to print all files that will be linted, for debugging purposes.
@camchenry

Copy link
Copy Markdown
Member

Superseded by #22546. Implemented as --debug files for some consistency with other debug settings that we are adding.

@camchenry camchenry closed this May 19, 2026
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

6 participants