feat: support file arguments in CLI for targeted linting#556
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature for targeted linting by allowing file paths as CLI arguments. The implementation is well-structured, with changes to the CLI handling, linter logic, and comprehensive unit and end-to-end tests. The documentation has also been updated accordingly. I've identified one potential performance issue in the file filtering logic that could affect larger projects, and I've left a specific comment with a suggestion for optimization. Overall, this is a great addition that will improve the developer experience.
965eb20 to
9643334
Compare
Deploying rslint with
|
| Latest commit: |
fa7dde6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://739d0dcf.rslint.pages.dev |
| Branch Preview URL: | https://feat-cli-file-args-20260320.rslint.pages.dev |
9643334 to
b210d25
Compare
Add support for `rslint [OPTIONS] [files...]` so users can lint specific files instead of always scanning the entire project. This enables lint-staged integration and faster feedback loops. - Parse positional args via flag.Args() and pass as allowFiles to RunLinter - Add isFileAllowed() with os.SameFile fallback for symlink compatibility - Exit with code 1 when specified files are not found in the project - Add 10 Go unit tests and 18 e2e tests covering edge cases - Update CLI docs with file arguments section
b210d25 to
fa7dde6
Compare
Summary
Add support for
rslint [OPTIONS] [files...]so users can lint specific files instead of always scanning the entire project. This enables lint-staged integration and faster feedback loops during development.Changes
Core (
cmd/rslint/cmd.go)flag.Args()and resolve to absolute pathsallowFilestoRunLinterto restrict linting scopeLinter (
internal/linter/linter.go)isFileAllowed()functionos.SameFileinode comparison to handle directory symlinks (e.g./var→/private/varon macOS)Docs (
website/docs/en/guide/cli.md)Behavior
When file arguments are provided, only those files are linted. Configuration rules still apply — only the scan scope changes.
Related Links
Addresses user feedback that rslint CLI does not support passing file arguments, preventing lint-staged integration.
Checklist
internal/linter/linter_test.go)packages/rslint-test-tools/tests/cli/file-args.test.ts)