Skip to content

Feature/#147 add husky + prettier #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

export readonly husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

exit $exitCode
fi
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

node_modules/pretty-quick/bin/pretty-quick.js --staged

File renamed without changes.
6 changes: 1 addition & 5 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"type-check:watch": "npm run type-check -- --watch",
"test": "jest -c ./config/test/jest.js --verbose",
"test:watch": "npm run test -- --watchAll -i --no-cache",
"clean": "rimraf dist",
"prettier": "prettier {config,src}/**/*{.js,.jsx,.ts,.tsx}",
"prettier:fix": "npm run prettier -- --fix"
"clean": "rimraf dist"
},
"repository": {
"type": "git"
Expand Down Expand Up @@ -72,8 +70,6 @@
"lint-staged": "^9.5.0",
"mini-css-extract-plugin": "^0.8.0",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"pretty-quick": "^2.0.1",
"react-test-renderer": "^16.12.0",
"rimraf": "^3.0.0",
"style-loader": "^1.0.1",
Expand Down
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "code-paster",
"scripts": {
"install": "run-p -l backend:install frontend:install",
"backend:install": "cd back && npm install",
"frontend:install": "cd front && npm install"
},
"devDependencies": {
"husky": "^7.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3"
}
}