Unexpected end of JSON input while parsing empty string on empty json config file #15781
Labels
locked-due-to-inactivity
Please open a new issue and fill out the template instead of commenting.
Environments:
Steps to reproduce:
Given a file
.prettierrc.json
that is just empty, run the command:prettier --write '**/*.{js,ts,json,md}'
Expected behavior:
Things don't break :)
Actual behavior:
With Prettier 3.1.1 this will throw with:
The fix is to add
{}
to.prettierrc.json
and things will work just fine. It's a small regression from 3.1.0 to 3.1.1 that I ran into. It's likely related to #15363.My use case was to have the empty file, so everything is using prettier defaults and VSCode uses the existence of that file to enable prettier within the editor.
Not sure if worth a fix, since my use case might be very much an edge case you don't need to account for, but with this issue here it's at least searchable & solvable for others who run into this :)
The text was updated successfully, but these errors were encountered: