-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
📝 Inconsistency between Prettier and Biome when formatting package.json #4299
Comments
It seems that Prettier actually creates a special case for // bunx prettier package.json
{
"name": "biome-repro",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"format": "biome format .",
"lint": "biome lint",
"check": "biome check",
"ci": "biome ci"
},
"devDependencies": {
"@biomejs/biome": "1.9.3"
},
"anyKey": [
"foo",
"bar"
]
}
// bunx prettier anyother.json
{
"name": "biome-repro",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"format": "biome format .",
"lint": "biome lint",
"check": "biome check",
"ci": "biome ci"
},
"devDependencies": {
"@biomejs/biome": "1.9.3"
},
"anyKey": ["foo", "bar"]
} |
Yup. Prettier makes this exception so it's output aligns with what is output from package managers like npm and yarn. |
Now looking at the v2.0 roadmap, it seems that this was already added there 3 days before my issue 😅 (as "Format |
The current issue isn't a bug. Biome formats the JSON file as expected. Creating an option and applying it to the package would be a breaking change nonetheless. We will keep that issue open. |
I added it one week ago. We should take care of still allowing users to set formatting options for Sometimes I wonder why expanding array/object is not the default for JSON... However, I think we should keep the same defaults as Prettier. |
That's a great solution! I am going to close this issue. I opened this one #4370 |
Environment information
Configuration
Playground link
https://github.com/alissonlauffer/biome-repro-1728945668010
Code of Conduct
The text was updated successfully, but these errors were encountered: