Skip to content

ci(devops): add a pre-commit hook that formats and lints staged files - #59

Merged
salahmyn merged 4 commits into
feature/quality-gates-twig-parity-auditfrom
feature/SAL-3523-add-pre-commit-hook-formats-lints-staged-files
Oct 27, 2026
Merged

salahmyn merged 4 commits into
feature/quality-gates-twig-parity-auditfrom
feature/SAL-3523-add-pre-commit-hook-formats-lints-staged-files

Conversation

@salahmyn

@salahmyn salahmyn commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm install now sets core.hooksPath to .githooks (the prepare script skips quietly outside a git checkout). The pre-commit hook runs Prettier (write) and ESLint (--fix) on staged ts/tsx/js/json/scss/css/md files only, re-stages them, and refuses the commit on remaining lint errors. It does not run tests. No new dependencies: a small shell script, no lint-staged.

Verification

  • Badly formatted staged file is reformatted; a staged file with lint errors exits 1.
  • pnpm lint (0 errors), format:check, typecheck (after build), build, check:manifest pass.
  • pnpm test: 4 wishlist-heart tests in ProductDetails.test.tsx fail locally (localStorage.clear undefined, local Node 26 vs the pinned 22); unrelated to this change.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the Windows installation issue is fixed and no new blocking issue was found.

Summary

Adds a pre-commit hook that formats and lints staged files, then stages the results.

  • The commit hook formats and fixes supported staged files before they are committed.

Reviews (4) · Last reviewed commit: "fix(devops): install the git hook from a..." · Reviewed by Greptile

pnpm install points core.hooksPath at .githooks. The hook runs Prettier and ESLint --fix on staged files only and re-stages them; remaining lint errors refuse the commit.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>
@sallainternalbot
sallainternalbot Bot marked this pull request as draft October 26, 2026 20:33
@salahmyn

Copy link
Copy Markdown
Member Author

@greptileai please review this pull request.

Comment thread .githooks/pre-commit Resolved
Comment thread .githooks/pre-commit Resolved
@salahmyn

Copy link
Copy Markdown
Member Author

This branch conflicts with the base branch feature/quality-gates-twig-parity-audit, which has moved (CI, knip, F4 and F7 are merged), so CI and the review have not run on it. Please rebase on the base branch, resolve the conflicts (likely package.json and pnpm-lock.yaml), run build, typecheck, lint, format:check, test:coverage, check:manifest and knip, push, and wait for the Greptile review and the Quality gates check to pass.

salahmyn and others added 2 commits October 27, 2026 07:02
…y staged files

decision(devops): reject files with unstaged changes instead of stashing, so the hook never rewrites work the contributor left out of the commit.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>
…t hook branch

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>

Copy link
Copy Markdown
Member Author

@greptile-apps please review

@salahmyn

Copy link
Copy Markdown
Member Author

@greptileai review

Comment thread package.json Resolved
…works on Windows

decision(devops): the shell one-liner used [ and true, which cmd.exe lacks; a small Node script behaves the same on every platform.

Made-with: agent
Co-authored-by: mc-agents[bot] <298817976+mc-agents[bot]@users.noreply.github.com>

Copy link
Copy Markdown
Member Author

@greptile-apps please review

@salahmyn
salahmyn marked this pull request as ready for review October 27, 2026 10:43
@greptile-apps

greptile-apps Bot commented Oct 27, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository.

@salahmyn
salahmyn merged commit 66bf41a into feature/quality-gates-twig-parity-audit Oct 27, 2026
4 checks passed
@salahmyn
salahmyn deleted the feature/SAL-3523-add-pre-commit-hook-formats-lints-staged-files branch October 27, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant