Skip to content

Commit 12772a8

Browse files
committed
chore(ui): update pre-commit hook to run linting only when UI code changes
1 parent 64e53c9 commit 12772a8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ui/git-hooks/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
#
88
# To enable this hook, rename this file to "pre-commit".
99

10+
UI_DIR_PATTERN='^ui/src/'
11+
12+
git diff --cached --name-only | grep ${UI_DIR_PATTERN} --quiet
13+
IS_UI_CHANGED=$?
14+
15+
if [ ${IS_UI_CHANGED} -ne 0 ]; then
16+
echo "[pre-commit hook] No UI code changes detected. Skip linting."
17+
exit 0
18+
fi
19+
1020
LINT_CMD='npm --prefix ./ui run lint -- --color'
1121

1222
echo "[pre-commit hook] Linting...\n"

0 commit comments

Comments
 (0)