feat(cli): migrate JSON config to JS/TS when running --init#566
feat(cli): migrate JSON config to JS/TS when running --init#566
--init#566Conversation
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 introduces a significant enhancement to 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
The pull request refactors the InitDefaultConfig logic into a new config_init.go file, introducing a comprehensive system to migrate old JSON/JSONC configuration files to new JS/TS formats. This system intelligently generates default configurations based on project type and deduplicates rules against recommended presets for various plugins. However, the current implementation for formatting complex rule values in the generated config files is not robust and could produce invalid JavaScript, requiring a more reliable escaping mechanism. Additionally, the hardcoded recommended rule maps pose a maintenance burden and risk becoming outdated, suggesting an automated generation process for these maps to ensure consistency and prevent incorrect rule deduplication.
1dbd709 to
57c4df5
Compare
Deploying rslint with
|
| Latest commit: |
80d19cd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://152b6a2c.rslint.pages.dev |
| Branch Preview URL: | https://feat-init-migrate-json-20260.rslint.pages.dev |
3925773 to
42e0a17
Compare
When `rslint --init` detects an existing `rslint.json`/`rslint.jsonc` (but no JS/TS config), it now automatically migrates the JSON config to the equivalent JS/TS format instead of erroring out. The migration deduplicates rules that match recommended presets, preserves user overrides, and deletes the old JSON file. Closes #565
42e0a17 to
80d19cd
Compare
Summary
When users have a deprecated
rslint.jsonand runrslint --initas suggested by the deprecation warning, it now automatically migrates the JSON config to JS/TS format instead of erroring with "config file already exists".Key behaviors:
js/ts/react/importrecommended presets (same severity → stripped)languageOptions,settings.ts(tsconfig exists),.js(ESM),.mjs(CJS)Related Links
Closes #565
Checklist