syncpack
syncpack copied to clipboard
feat(fix): preserve original formatting
Description
Given:
{
"name": "syncpack-format",
"version": "1.0.0",
"scripts": {
"lint": "syncpack lint",
"fix": "syncpack fix-mismatches"
},
"keywords": ["test"],
"devDependencies": {
"syncpack": "^12.3.0"
},
"syncpack": {
"lintFormatting": false
}
}
Running npm run fix will rewrite the keywords property with unnecessary newlines even with lintFormatting indicated as false.
"keywords": [
"test"
],
Suggested Solution
I imagine it's a headache to consider whitespace when reconstituting files, but it would be preferable for keys that aren't changed to be emitted the same as how they're read if formatting is turned off.
Thanks @nlwillia, yeah tricky one as this is being done basically by JSON.stringify.