Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Trailing Commas in repomix.config.json #346

Open
rockmandash opened this issue Feb 10, 2025 · 2 comments · Fixed by #366
Open

Allow Trailing Commas in repomix.config.json #346

rockmandash opened this issue Feb 10, 2025 · 2 comments · Fixed by #366
Assignees
Labels
enhancement New feature or request

Comments

@rockmandash
Copy link

When working with the "includes" key, I often comment out file paths to quickly test or calculate final token counts. However, I have to manually remove the trailing comma every time. Since comments are already supported in repomix.config.json, it would be very helpful if trailing commas were supported as well.

For reference, you can see where this is handled in our code:

const config = JSON.parse(stripJsonComments(fileContent));

Additionally, the json5 library, which we could consider as an alternative, supports trailing commas.

@rockmandash
Copy link
Author

rockmandash commented Feb 10, 2025

Or maybe we should support repomix.config.js javascript format? This way I can even inline instruction.md file using tagged template literal, no need separate files.

@yamadashy
Copy link
Owner

Hi, @rockmandash !
Thank you for the suggestion!

Yes, parsing with json5 sounds like a good solution for the trailing comma issue.

Regarding the js/ts config file support - I've been considering this for a while but haven't implemented it yet due to complexity concerns. I know there's demand for it, so I'll keep it under consideration for future updates.

@yamadashy yamadashy self-assigned this Feb 11, 2025
@yamadashy yamadashy added enhancement New feature or request good first issue Good for newcomers labels Feb 16, 2025
yamadashy added a commit that referenced this issue Feb 22, 2025
- Replace JSON.parse with JSON5.parse for configuration file loading
- Update tests to cover JSON5 features (comments, trailing commas)
- Update documentation to reflect JSON5 support
- Add json5 package as a dependency
yamadashy added a commit that referenced this issue Feb 22, 2025
- Replace JSON.parse with JSON5.parse for configuration file loading
- Update tests to cover JSON5 features (comments, trailing commas)
- Update documentation to reflect JSON5 support
- Add json5 package as a dependency
@yamadashy yamadashy reopened this Feb 22, 2025
@yamadashy yamadashy removed the good first issue Good for newcomers label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants