We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 70a2df6 commit effa7a2Copy full SHA for effa7a2
.githooks/pre-commit
@@ -54,6 +54,14 @@ if [ -n "$PHP_FILES" ]; then
54
echo "$PHP_FILES" | xargs composer lint:fix > /dev/null 2>&1 || { echo "PHP formatting failed"; exit 1; }
55
fi
56
57
+# Get all changed JS/TS files.
58
+JS_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep -E "\.(js|jsx|ts|tsx)$" || true)
59
+
60
+# Run JS linting on changed files.
61
+if [ -n "$JS_FILES" ]; then
62
+ echo "$JS_FILES" | xargs npm run lint:js -- || { echo "JavaScript linting failed"; exit 1; }
63
+fi
64
65
# Run the WordPress formatter without showing all file output.
66
npm run format > /dev/null 2>&1 || { echo "JavaScript formatting failed"; exit 1; }
67
0 commit comments