mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 06:57:36 +00:00
Add json sorting pre-commit hook
This commit is contained in:
parent
d8cf78b4e4
commit
d368e0eaf6
@ -28,3 +28,10 @@ repos:
|
|||||||
rev: v0.11.3
|
rev: v0.11.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: stylua
|
- id: stylua
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: sort-json
|
||||||
|
name: sort json files with jq
|
||||||
|
language: script
|
||||||
|
entry: ./scripts/sort-json.sh
|
||||||
|
files: "(\\.json$|^neovim/packer_snapshots/)"
|
||||||
|
7
scripts/sort-json.sh
Executable file
7
scripts/sort-json.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
for f in "$@"; do
|
||||||
|
jq --sort-keys --monochrome-output . "$f" > "$f.tmp"
|
||||||
|
mv "$f.tmp" "$f"
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user