feat: support upward config discovery and directory arguments in CLI#560
feat: support upward config discovery and directory arguments in CLI#560
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 is an excellent pull request that significantly improves configuration discovery to align with ESLint v10's behavior. The introduction of upward directory traversal, multi-config support for monorepos, and the refactoring of payload parsing and program creation logic are all well-executed. The addition of comprehensive tests for both the Go and TypeScript changes is particularly commendable and ensures the new logic is robust.
I have found one area for improvement in the Go CLI implementation to ensure the new implicit CWD scoping feature is applied consistently across all configuration types, not just the new multi-config format. Please see the detailed comment.
Deploying rslint with
|
| Latest commit: |
1bac9b1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fb28c266.rslint.pages.dev |
| Branch Preview URL: | https://feat-cli-config-discovery-20.rslint.pages.dev |
b11f005 to
9f6a948
Compare
5982f8b to
6d5e3ab
Compare
3bba73c to
7cc64e1
Compare
Add upward directory traversal for config file discovery, multi-config
support for monorepo scenarios, and directory argument support with
proper scoping.
- Config discovery walks up from file/directory location to filesystem
root, finding the nearest config file
- Multiple files from different packages can use different configs
- Directory arguments (e.g. `rslint src/`) scope linting to that subtree
- No-args implicitly scopes to CWD (same as `rslint .`)
- Extract `createProgramsForConfig` to eliminate program creation
duplication across config paths
- Extract `parseConfigPayload` for testable stdin payload parsing
- New multi-config stdin payload format: `{ configs: [...] }`
with backward compatibility for legacy single-config format
- Update CLI and configuration docs
7cc64e1 to
1bac9b1
Compare
Summary
Config Discovery
rslint.config.*filesCLI Enhancements
rslint src/) with proper scoping — only files under the specified directory are lintedrslint .)parseArgsto register known Go string flags (--format,--max-warnings, etc.) so their values are not mistaken for file argumentsCode Quality
src/utils/(args.ts,config-discovery.ts) for cleaner public API and testabilitycreateProgramsForConfigandparseConfigPayloadon Go side to eliminate duplication{ configs: [...] }with backward compatibilityProject Config Migration
rslint.jsontorslint.config.tsusingts.configs.recommendedpresetpackage.jsonlint command to use--config rslint.config.tsKnown Limitation
When a project mixes JSON config (root) with JS configs (sub-packages), the JS config path takes precedence and the JSON config is bypassed. JSON config is deprecated — projects should migrate to JS/TS config.
Related Links
ESLint v10 config lookup behavior: https://eslint.org/docs/latest/use/configure/configuration-files
Checklist