From 3ae2f04f313e2767cb990b019eadbbe7f0ac4b67 Mon Sep 17 00:00:00 2001 From: Zain Sajjad Date: Mon, 2 Nov 2020 03:34:50 +0500 Subject: [PATCH] Added pre commit hook --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ package.json | 2 ++ yarn.lock | 5 +++++ 4 files changed, 12 insertions(+) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..f6884b1 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname $0)/_/husky.sh" + +yarn test \ No newline at end of file diff --git a/package.json b/package.json index 72a8935..3024a4b 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", + "pretest": "yarn lint --fix --quiet", "test": "jest", "lint": "eslint ." }, @@ -54,6 +55,7 @@ "fetch-mock": "^9.10.7", "fetch-mock-jest": "^1.3.0", "fs": "^0.0.1-security", + "husky": "^5.0.0-beta.0", "jest": "^26.6.1", "metro-react-native-babel-preset": "^0.63.0", "path": "^0.12.7", diff --git a/yarn.lock b/yarn.lock index c0c753d..224a345 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3779,6 +3779,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +husky@^5.0.0-beta.0: + version "5.0.0-beta.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-5.0.0-beta.0.tgz#b09c5a7da1da884cfd9ff0d7cfd328b77e068516" + integrity sha512-gemLvVKIeuSuu+xp+hY5DUNjNSNk4YIgdsFhC3Wwv6tpc8VIGNR+0g+5uOpsiNNlAekcaMfO06mwSSokqLAlhQ== + iconv-lite@0.4.24, iconv-lite@^0.4.17: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"