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

Add canonicalize ast pass to jsonnetfmt. #722

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

netomi
Copy link
Contributor

@netomi netomi commented Aug 11, 2023

This PR is a POC implementation for #721 .

It is intended to get feedback if something like this makes sense and if the implementation of that is reasonable.

The PR only considers objects and arrays and will sort them using the following criteria.

objects:

  • locals and asserts are untouched and should be above all other object fields
  • object fields are converted to string representation using unparser
  • comments and whitespace are stripped when converting to string representation

arrays:

  • elements are converted to string representation using unparser

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 this pull request may close these issues.

1 participant