mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
Add new hook pretty-format-json
This new hook allows to standardize one's JSON files (sorted key/4 spaces indent). By default it just fails if any file is not complying with the standard, but you can also pass the arg `--autofix` and the hook will pretty-format the file itself. Good in use combined with the `check-json` hook.
This commit is contained in:
parent
cf550fcab3
commit
55bf22dc4a
7 changed files with 134 additions and 2 deletions
5
testing/resources/not_pretty_formatted_json.json
Normal file
5
testing/resources/not_pretty_formatted_json.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"foo": "bar",
|
||||
"alist": [2, 34, 234],
|
||||
"blah": null
|
||||
}
|
||||
9
testing/resources/pretty_formatted_json.json
Normal file
9
testing/resources/pretty_formatted_json.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"alist": [
|
||||
2,
|
||||
34,
|
||||
234
|
||||
],
|
||||
"blah": null,
|
||||
"foo": "bar"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue