Skip to content

Commit

Permalink
Added husky as dev dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Oct 11, 2024
1 parent babc030 commit 6e0f065
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .husky/_/applypatch-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
22 changes: 22 additions & 0 deletions .husky/_/h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env sh
[ "$HUSKY" = "2" ] && set -x
n=$(basename "$0")
s=$(dirname "$(dirname "$0")")/$n

[ ! -f "$s" ] && exit 0

if [ -f "$HOME/.huskyrc" ]; then
echo "husky - '~/.huskyrc' is DEPRECATED, please move your code to ~/.config/husky/init.sh"
fi
i="${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh"
[ -f "$i" ] && . "$i"

[ "${HUSKY-}" = "0" ] && exit 0

export PATH="node_modules/.bin:$PATH"
sh -e "$s" "$@"
c=$?

[ $c != 0 ] && echo "husky - $n script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit $c
9 changes: 9 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo "husky - DEPRECATED
Please remove the following two lines from $0:
#!/usr/bin/env sh
. \"\$(dirname -- \"\$0\")/_/husky.sh\"
They WILL FAIL in v10.0.0
"
2 changes: 2 additions & 0 deletions .husky/_/post-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/post-rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-applypatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-auto-gc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-merge-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/pre-rebase
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
2 changes: 2 additions & 0 deletions .husky/_/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname "$0")/h"
15 changes: 15 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

RED="\033[1;31m" ; NC="\033[0m"

if npm ls -g eslint &> /dev/null || npm ls eslint &> /dev/null ; then
npm run lint
else
PROJECT_ROOT=$(
cd "$(dirname "$0")/.." && # nav to root
[ "$OSTYPE" == "msys" ] && pwd -W || pwd # get absolute path
)
echo -e "\n${RED}Warning: eslint not installed${NC}"
echo -e " To add missing dependencies, run 'npm install' from"
echo -e " $PROJECT_ROOT\n"
fi
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"devDependencies": {
"eslint": "^9.12.0",
"eslint-plugin-json": "^4.0.1"
"eslint-plugin-json": "^4.0.1",
"husky": "^9.1.6"
},
"scripts": {
"lint": "eslint . --cache",
Expand Down

0 comments on commit 6e0f065

Please sign in to comment.