You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the fact that the parser does not take white-space into account, there are two options:
use a parser other than JSON.parse which will take the white-space into account
update the documentation to indicate that "--indent" only applies when other modifications are made; so from -i, --indent [value] override indentation. defaults to " " to -i, --indent [value] the indentation to use if other modifications are made. defaults to " "
The text was updated successfully, but these errors were encountered:
Description
syncpack format --source "PATH-TO-PACKAGE-JSON"
to make sure properties are now in the correct ordersyncpack format --indent '....' --source "PATH-TO-PACKAGE-JSON"
....
is not used as indentation.The expected output is that indentation will be four periods (this is purely for demonstration purposes).
Suggested Solution
The issue appear to be here: https://github.com/JamieMason/syncpack/blob/master/src/commands/lib/write-if-changed.ts#L11
The comparison is the trimmed input line (meaning: no leading white space) with the indent added in front. When you compare that to the "after", there are no differences because the order of the keys is not changing at all.
Based on the fact that the parser does not take white-space into account, there are two options:
JSON.parse
which will take the white-space into account-i, --indent [value] override indentation. defaults to " "
to-i, --indent [value] the indentation to use if other modifications are made. defaults to " "
The text was updated successfully, but these errors were encountered: