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

Pin Prettier version #5

Closed
javier-sierra-sngular opened this issue Jan 24, 2024 · 2 comments · Fixed by #6
Closed

Pin Prettier version #5

javier-sierra-sngular opened this issue Jan 24, 2024 · 2 comments · Fixed by #6
Assignees

Comments

@javier-sierra-sngular
Copy link
Contributor

Prettier has deployed a patch version (3.2.3) that changes the parser used for .json files from json to jsonc. This parser set trailing commas to "all", and this breaks JSON specification.

The proposal is to set a fixed Prettier version like 3.2.2 solving previous problem with .json files and preventing future breaking changes.

This is, in fact, an official Prettier recommendation:

[...] we change how code is formatted in each release! It’s important to have a locked down version of Prettier in your package.json. And it’s faster, too.

Copy link
Contributor

Thank you for collaborating with the project by giving us feedback!

@javier-sierra-sngular
Copy link
Contributor Author

javier-sierra-sngular commented Jan 25, 2024

It seems that the parser used in .json files is different for each file (name?)

$ prettier --file-info tsconfig.json 
{ "ignored": false, "inferredParser": "jsonc" }
$ prettier --file-info package.json 
{ "ignored": false, "inferredParser": "json-stringify" }
$ prettier --file-info data.json 
{ "ignored": false, "inferredParser": "json" }

Normal json files are being parsed with normal json parser, so it is not breaking normal json files currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant