Skip to content

Commit

Permalink
feat: Add Husky
Browse files Browse the repository at this point in the history
Use Husky to run the linter and tests before any commit so we catch errors earlier
  • Loading branch information
leinelissen committed Jan 7, 2022
1 parent 7c875c3 commit 1416a05
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# empty for now
12 changes: 12 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Check if there are any outstanding changes
# NOTE: This is necessary as husky will run checks on pushing,
# while there might be changes that are not yet committed interfering
# with the tests and linter
npx husky-init && npm install

npm run lint
npm run make
npm test
22 changes: 22 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"test": "playwright test",
"prepare:nodegit": "node scripts/prepareNodegit.js",
"rebuild:native-modules": "electron-rebuild",
"postinstall": "npm run prepare:nodegit"
"postinstall": "npm run prepare:nodegit",
"prepare": "husky install"
},
"keywords": [],
"author": {
Expand Down Expand Up @@ -64,6 +65,7 @@
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-react": "7.27.1",
"husky": "7.0.4",
"mini-css-extract-plugin": "2.4.5",
"node-loader": "2.0.0",
"playwright": "1.17.1",
Expand Down

0 comments on commit 1416a05

Please sign in to comment.