We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a44f6dc commit bec5e5cCopy full SHA for bec5e5c
.husky/pre-commit
@@ -1 +1,17 @@
1
-yarn lint --fix
+#!/bin/sh
2
+. "$(dirname "$0")/_/husky.sh"
3
+
4
+# Get all staged files
5
+STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
6
7
+if [ -n "$STAGED_FILES" ]; then
8
+ echo "Running lint with fix on staged files..."
9
+ # Run lint on all files (modifies files in the working directory)
10
+ yarn lint --fix
11
12
+ echo "Re-adding originally staged files to the staging area..."
13
+ # Re-add only the originally staged files
14
+ echo "$STAGED_FILES" | xargs git add
15
+else
16
+ echo "No staged files to process."
17
+fi
0 commit comments