-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Reformat all JSON using prettier #2255
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
Conversation
This also includes sorting mapping keys in JSON files. Fixes: SchemaStore#2248
This looks great to me. @GerryFerdinandus what do you think? |
@madskristensen Also please do not forget to visit https://pre-commit.ci/ sign and enable integration for this repository. That will allow it to auto-fix incoming PRs. We do this on many Ansible repositories, it is awesome as we all forget to do run it locally from time to time. |
Looks good. |
You do not really have to remember doing it, the linter will move the key to expected location even if you put it in wrong place. |
Thank you!! |
after the fact.......... but this ^^^ is awesome..... TY everyone. |
I don't like the new format, as it puts the Instead of sorting the properties alphabetically, they should be sorted for human readability, in this (incomplete) order:
I noticed that the top-level properties are sorted, but the properties at deeper levels aren't. Is that on purpose? I'm glad though that the Sorting the properties alphabetically seems to say that JSON schema files should not be viewed in a text editor, but rather only in specialized tools that automatically present the structure in a more human-friendly way. |
@rillig We are aware of the downsides of alphabetical order but given the current limitations, alphabetical is better than arbitrary one as it makes hard to diff schemas and it does not produce predictable results. In the end what is "natural" for one user might not be seen such by another one. Think about it as "normalization". Regarding future, take a look at json-schema-org/json-schema-vocabularies#7 as there is a plan to declare sorting order for schemas. Once we will agree on that, we will be able to update prettier sorter to respect them, bringing back I am aware that the sorting was not recursive and that was only due to a configuration mistake in sorter config. I was planning to correct it. |
Is there |
This also includes sorting mapping keys in JSON files. Only the first file was manually modified, the pre-commit config, all the others were result of running it. I know that looks ugly, but it will make further contributions easier to review.
Fixes: #2248