Favicon of Pre-commit Quality Gate

Pre-commit Quality Gate

Comprehensive pre-commit hook that runs linting, type checking, tests, and security scans before allowing commits. Prevents bad code from entering the repository.

Pre-commit Quality Gate Hook

#!/bin/bash

set -e

echo "Running pre-commit quality checks..."

# Lint
echo "Linting..."
npm run lint

# Type check
echo "Type checking..."
npm run type-check

# Tests
echo "Running tests..."
npm test

# Security scan
echo "Security scan..."
npm audit

echo "All checks passed!"

Installation

  1. Save to .git/hooks/pre-commit
  2. Make executable: chmod +x .git/hooks/pre-commit

Requirements

  • Git
  • Node.js
  • npm

Integrations

  • ESLint for linting
  • TypeScript for type checking
  • Jest/Vitest for testing
  • npm audit for security

This hook prevents commits with quality issues, ensuring clean code in your repository.

Categories:

Share:

Ad
Favicon

 

  
 

Similar to Pre-commit Quality Gate

Favicon

 

  
  
Favicon

 

  
  
Favicon