lint: exclude file generated by nvfetcher

Fix pre-commit hook to only format staged files
pull/229/head
teutat3s 2023-05-05 18:32:40 +02:00
parent c65f185773
commit d28da2e1e6
Signed by: teutat3s
GPG Key ID: 4FA1D3FA524F22C1
2 changed files with 5 additions and 4 deletions

View File

@ -7,15 +7,15 @@ else
against=$(${git}/bin/git hash-object -t tree /dev/null)
fi
diff="git diff-index --name-only --cached $against --diff-filter d"
mapfile -t all_files < <($diff)
# Stash only unstaged changes, keeping staged changes
old_stash=$(git rev-parse --quiet --verify refs/stash)
git stash push --quiet --keep-index -m 'Unstaged changes before pre-commit hook'
new_stash=$(git rev-parse --quiet --verify refs/stash)
diff="git diff-index --name-only --cached $against --diff-filter d"
mapfile -t all_files < <($diff)
# Format staged files
if ((${#all_files[@]} != 0)); then
treefmt "${all_files[@]}" &&

View File

@ -1,6 +1,7 @@
[formatter.nix]
command = "alejandra"
includes = ["*.nix"]
excludes = ["pkgs/_sources/generated.nix"]
[formatter.prettier]
command = "prettier"