Skip to content

Instantly share code, notes, and snippets.

@rainzoo
Created December 27, 2025 10:38
Show Gist options
  • Select an option

  • Save rainzoo/869f4148040ced8efeeded4bdac0f10d to your computer and use it in GitHub Desktop.

Select an option

Save rainzoo/869f4148040ced8efeeded4bdac0f10d to your computer and use it in GitHub Desktop.
Generic pre-commit Config
repos:
# 1. General Hygiene & Security
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-added-large-files
args: ['--maxkb=500']
- id: check-merge-conflict
- id: detect-private-key
# 2. Secret Scanning (Highly Recommended)
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
# 3. Spelling & Typos (Across all file types)
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--skip", "*.lock"]
# 4. GitHub Actions / Schema Validation
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
hooks:
- id: check-github-workflows
# 5. Python: Ruff & Modernization
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.0
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
# 6. Python: Security & Unused Deps
- repo: https://github.com/pypa/pip-audit
rev: v2.7.3
hooks:
- id: pip-audit
args: ["--local"]
- repo: https://github.com/spulec/creosote
rev: v3.1.0
hooks:
- id: creosote
args: ["--paths", "src", "--deps-file", "requirements.txt"]
# 7. React/JS: Biome & Knip
- repo: https://github.com/biomejs/pre-commit
rev: v0.1.0
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@latest"]
args: ["--write"]
- repo: local
hooks:
- id: knip
name: knip
entry: npx knip
language: node
pass_filenames: false
always_run: true
description: "Find unused files, dependencies, and exports in JS/TS projects."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment