From 3fda9f447d11c24fc63d77c0e6983601dbdec1d6 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Thu, 15 Aug 2024 00:47:30 +0200 Subject: [PATCH] Add additional checks for pre-commit hook (#32142) Signed-off-by: Jon Koops --- js/.husky/pre-commit | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/.husky/pre-commit b/js/.husky/pre-commit index 24f1b40ca6..597d414f60 100755 --- a/js/.husky/pre-commit +++ b/js/.husky/pre-commit @@ -7,4 +7,14 @@ if [ ! -f "$FILE" ]; then exit 0; fi +# Exit if dependencies are not installed. +if [ ! -d "node_modules" ]; then + exit 0; +fi + +# Exit if pnpm is not installed. +if ! [ -x "$(command -v pnpm)" ]; then + exit 0; +fi + pnpm exec lint-staged