mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-23 12:37:39 +08:00
19 lines
No EOL
682 B
Text
19 lines
No EOL
682 B
Text
# Get list of staged files
|
|
STAGED_JS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(js|jsx|ts|tsx)$' || true)
|
|
STAGED_PHP_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.php$' || true)
|
|
STAGED_CSS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(css|scss)' || true)
|
|
|
|
# Run JS linting if there are staged JS files
|
|
if [ -n "$STAGED_JS_FILES" ]; then
|
|
npm run lint:js || exit 1
|
|
fi
|
|
|
|
# Run PHP linting if there are staged PHP files
|
|
if [ -n "$STAGED_PHP_FILES" ]; then
|
|
npm run lint:php:report || exit 1
|
|
fi
|
|
|
|
# Run CSS linting if there are staged CSS files
|
|
if [ -n "$STAGED_CSS_FILES" ]; then
|
|
npm run lint:css || exit 1
|
|
fi |