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

fix(formatter): never format biome.json with trailing commas #3007

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented May 27, 2024

Summary

This ensures that trailing commas is always disabled when formatting biome.json or biome.jsonc. Failing to do so could result in biome formatting it's own configuration such that it's no longer valid json, and would not get parsed. The full context is in #2990.

fixes #2990

Test Plan

I added a cli test for this scenario.

cargo test -p biome_cli always_disable_trailing_commas_biome_json

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project labels May 27, 2024
@Conaclos
Copy link
Member

Should we accept trailing commas for jsonc? If I remember correctly we allow comments and trailing commas for file ending with the .jsonc extension.

@dyc3
Copy link
Contributor Author

dyc3 commented May 28, 2024

It appears that other implementations allow for trailing commas in jsonc, so I'll remove that.

From a quick search:

@dyc3 dyc3 force-pushed the 05-27-fix_formatter_never_format_biome.json_with_trailing_commas branch from 04d955d to d777a43 Compare May 28, 2024 11:48
@dyc3 dyc3 force-pushed the 05-27-fix_formatter_never_format_biome.json_with_trailing_commas branch from d777a43 to eb33352 Compare May 28, 2024 12:13
@Conaclos Conaclos merged commit 72a702c into biomejs:main May 28, 2024
10 checks passed
@dyc3 dyc3 deleted the 05-27-fix_formatter_never_format_biome.json_with_trailing_commas branch May 28, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Project Area: project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Buggy side-effect caused by previous fix that made biome.json(c) un-ignore-able
2 participants