DEV Community

Yogesh Galav
Yogesh Galav

Posted on

Husky pre-commit configuration for Laravel Vuejs.

Top comments (1)

Collapse
 
yogeshgalav7 profile image
Yogesh Galav
# .husky/pre-commit
./vendor/bin/duster fix --dirty || true
npx lint-staged || true

# Get list of staged PHP files
STAGED_FILES=$(git diff --cached --name-only --diff-filter=AM | grep '\.php$' | tr '\n' ' ')

if [ -n "$STAGED_FILES" ]; then
  # Run PHPStan only on staged PHP files
  composer phpstan $STAGED_FILES  || true
else
  echo "No PHP files to analyze."
fi
Enter fullscreen mode Exit fullscreen mode