BACK TO DIRECTORY
hookbeginner
Auto Format
Formats all staged files using Prettier before they are committed, ensuring consistent code style across the entire codebase. Supports JavaScript, TypeScript, CSS, JSON, Markdown, and more. Automatically stages the formatted changes so the commit contains the cleaned-up version. Eliminates all formatting discussions in code review.
612 STARS
9.9k DOWNLOADS
claude-templates
prettierformatstylepre-commitconsistency
CONFIGURATION
json
1{2 "hooks": {3 "pre-commit": {4 "command": "npx prettier --write --ignore-unknown $(git diff --cached --name-only --diff-filter=ACM | tr '\n' ' ') && git add $(git diff --cached --name-only --diff-filter=ACM | tr '\n' ' ')",5 "description": "Format staged files with Prettier and re-stage them",6 "on_failure": "warn",7 "timeout": 150008 }9 },10 "prettier_config": {11 "semi": true,12 "singleQuote": false,13 "trailingComma": "all",14 "tabWidth": 2,15 "printWidth": 80,16 "bracketSpacing": true,17 "arrowParens": "always",18 "endOfLine": "lf",19 "plugins": ["prettier-plugin-tailwindcss"]20 }21}