Skip to content

Instantly share code, notes, and snippets.

@jkriss
Last active September 29, 2022 03:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkriss/7316b2265fd9db507d03db227fc830e5 to your computer and use it in GitHub Desktop.
Save jkriss/7316b2265fd9db507d03db227fc830e5 to your computer and use it in GitHub Desktop.
pre-commit hook for deno fmt formatting
#!/bin/sh
FILES=$(deno fmt)
if [ -n "$FILES" ]; then
echo "formatted, adding files $FILES"
echo "$FILES" | xargs git add
fi
exit 0
@RussellSanders1
Copy link

fmt command should look like deno fmt 2>&1 | head -n -1 if you want to store the formatted files

@thesobercoder
Copy link

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment