Open swantzter opened 1 year ago
Yes, --pretty-print
will insert line breaks into empty objects, otherwise they'll be formatted only as two braces - {}
.
This file can be checked by jsonlint --check
:
{
"obj1": {},
"obj2": {}
}
And this file can be checked by jsonlint --check --pretty-print
:
{
"obj1": {
},
"obj2": {
}
}
It's a clumsy workaround. I'll try to come up with some fix.
Reproduction: https://github.com/swantzter/jsonlint-repro
Hi, we're having an issue where there's inconsistent behaviours between
--pretty-print
and "just" linting when it comes to empty objects.When pretty-print serialises an object it outputs
{\n}
whereas the lint want it to become just{}
Given the above reproduction and test.json:
running
npm run lint:fix
(jsonlint --in-place --pretty-print
) changes the file and outputs the followingRunning
npm run lint
(jsonlint
) after that makes it complain: