Skip to content

Commit

Permalink
add revert commit and exit push if there are format errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytram committed Nov 3, 2023
1 parent d883e97 commit 085dde2
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-push
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn format
yarn husky:format
yarn lint

14 changes: 13 additions & 1 deletion package.json
Expand Up @@ -8,6 +8,7 @@
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"husky:format": "lint-staged || (git reset --soft HEAD~1 && exit 1)",
"start": "dotenv -e ./.env.dev nest start",
"start:dev": "nest start --tsc --watch",
"start:debug": "nest start --debug --watch",
Expand Down Expand Up @@ -45,6 +46,7 @@
"class-validator": "^0.14.0",
"cookie-parser": "^1.4.6",
"dotenv": "^16.3.1",
"lint-staged": "^15.0.2",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
Expand All @@ -70,7 +72,7 @@
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"husky": "^8.0.3",
"husky": "^8.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"prisma": "^5.3.1",
Expand Down Expand Up @@ -101,5 +103,15 @@
},
"prisma": {
"seed": "ts-node prisma/seed/index.ts"
},
"lint-staged": {
"src/**/*.ts": [
"prettier --write",
"git add"
],
"test/**/*.ts": [
"prettier --write",
"git add"
]
}
}

0 comments on commit 085dde2

Please sign in to comment.