Skip to content

Commit bec5e5c

Browse files
committed
fix linting
1 parent a44f6dc commit bec5e5c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.husky/pre-commit

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
yarn lint --fix
1+
#!/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

Comments
 (0)