Skip to content

Commit

Permalink
Add pre-commit dprint hook, fix post-checkout hook (microsoft#55799)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored Sep 20, 2023
1 parent 190d709 commit bd902ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
npm run npx hereby -- generate-diagnostics
./node_modules/.bin/hereby generate-diagnostics || true
4 changes: 4 additions & 0 deletions scripts/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
if git diff --name-only --cached --relative | xargs --no-run-if-empty ./node_modules/.bin/dprint fmt; then
git diff --name-only --cached --relative | xargs --no-run-if-empty git add
fi
1 change: 1 addition & 0 deletions scripts/link-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const __dirname = path.dirname(__filename);

const hooks = [
"post-checkout",
"pre-commit",
];

hooks.forEach(hook => {
Expand Down

0 comments on commit bd902ea

Please sign in to comment.