From ca86001e7b3bc36ce26f74c3f92dc23017ee4a4e Mon Sep 17 00:00:00 2001 From: vikingowl Date: Tue, 7 Apr 2026 03:04:06 +0200 Subject: [PATCH] fix: pre-commit hooks for monorepo (golangci-lint cd, web deps, branch skip) --- .pre-commit-config.yaml | 14 +++++++------- Justfile | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 031ad51..1d22c86 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,15 +13,15 @@ repos: - id: no-commit-to-branch args: ['--branch', 'main'] - - repo: https://github.com/golangci/golangci-lint - rev: v2.1.6 - hooks: - - id: golangci-lint - files: ^backend/ - args: ['--config', 'backend/.golangci.yml'] - - repo: local hooks: + - id: golangci-lint + name: golangci-lint + entry: bash -c 'cd backend && golangci-lint run --config .golangci.yml ./...' + language: system + files: ^backend/.*\.go$ + pass_filenames: false + - id: go-fmt name: go fmt entry: bash -c 'cd backend && gofmt -w .' diff --git a/Justfile b/Justfile index ae6b00a..f9f4a1d 100644 --- a/Justfile +++ b/Justfile @@ -74,10 +74,11 @@ test: backend-test # Run all formatters fmt: backend-fmt web-fmt -# Install pre-commit hooks +# Install pre-commit hooks and ensure web deps are present hooks-install: pre-commit install + pnpm --dir web install --frozen-lockfile -# Run all pre-commit hooks against all files +# Run all pre-commit hooks against all files (skips branch protection — use feature branches for commits) hooks-run: - pre-commit run --all-files + SKIP=no-commit-to-branch pre-commit run --all-files