-
-
Notifications
You must be signed in to change notification settings - Fork 638
Open
Labels
Description
Problem
The pre-commit hook for Prettier is not running on staged .md files despite the glob pattern in .lefthook.yml including them.
Evidence
When committing CONTRIBUTING.md, the pre-commit hook output shows:
│ prettier (skip) no matching staged files
The .lefthook.yml configuration includes .md in the glob pattern:
prettier:
glob: "**/*.{js,jsx,ts,tsx,json,md,yml,yaml}"
run: bin/lefthook/prettier-format all-changed
stage_fixed: trueThis caused CI to fail with:
[warn] CONTRIBUTING.md
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
Expected Behavior
When staging .md files, the Prettier pre-commit hook should run and format them.
Root Cause Hypothesis
The issue might be that:
- Lefthook's glob matching doesn't correctly match
CONTRIBUTING.mdagainst**/*.{js,jsx,ts,tsx,json,md,yml,yaml} - The
bin/lefthook/prettier-format all-changedscript's regex pattern might not be correctly matching files in the root directory - There could be a mismatch between lefthook's glob evaluation and the actual staged files
Workaround
Run pnpm start format manually before committing, or ensure Prettier runs on all files.
Related
- PR Add bin/setup for unified development environment setup #2191 - Add bin/setup for unified development environment setup
🤖 Generated with Claude Code
coderabbitai