From 81cd5fac7e219a211d251aeed0206ba39932fda8 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 5 May 2022 21:21:48 +0800 Subject: [PATCH] Added linting check to a pre-commit hook refs https://github.com/TryGhost/Ghost/commit/648530009d233c65cdd903c674ccdf193b1ecce7 - Naz has broken the main too many times - it's time to stop the atrocities. - Having a lint check as a pre-commit hook will make it really hard commiting code with linting errors --- .github/hooks/pre-commit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit index 9dd0d0ef29..a8f5c646fd 100755 --- a/.github/hooks/pre-commit +++ b/.github/hooks/pre-commit @@ -1,4 +1,15 @@ #!/bin/bash +yarn lint +lintStatus=$? + +if [ $lintStatus -eq 0 ] +then + echo "linting succeeded" +else + echo "linting failed" + exit 1 +fi + # Modified from https://github.com/chaitanyagupta/gitutils green='\033[0;32m'