mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 15:56:27 +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
|
||||
hooks:
|
||||
- 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