feat(linter): Add --list-files to linter#17233
Conversation
There was a problem hiding this comment.
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-filescommand-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.
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>
9c6efd1 to
a4a545e
Compare
…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.
| @@ -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(); | |||
There was a problem hiding this comment.
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?
|
Following this from #19833 Just wondering if there are plans to merge this! This would be great to have! |
|
Superseded by #22546. Implemented as |
Allows listing of all matched files without actually linting.
Fix #13172.