From ee0d279408f64d90639c1076315b3549e9fb0c8e Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Tue, 18 Mar 2025 23:46:21 +0100 Subject: [PATCH] refactor(dev): improve ui pre-commit error This commit ensures users get a descriptive warning when they have not installed npm when trying to commit files into the ui folder which has a pre-commit hook setup. --- ui/.husky/pre-commit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/.husky/pre-commit b/ui/.husky/pre-commit index 2312dc58..050e87e8 100755 --- a/ui/.husky/pre-commit +++ b/ui/.husky/pre-commit @@ -1 +1,8 @@ +# Throw warnings if npm is not installed +if ! command -v npm >/dev/null 2>&1; then + echo "Error: npm is not installed. Please install npm to run lint-staged." + echo "You can use 'git commit --no-verify' to skip pre-commit checks (not recommended)." + exit 1 +fi + npx lint-staged