File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Get list of staged files
4+ STAGED_FILES=$( git diff --cached --name-only --diff-filter=ACMR | grep -E ' \.(js|jsx|ts|tsx)$' | sed ' s| |\\ |g' )
5+
6+ # If there are no staged files, exit successfully
7+ if [ -z " $STAGED_FILES " ]; then
8+ exit 0
9+ fi
10+
11+ # Run ESLint on staged files and capture both output and exit code
12+ echo " Running ESLint on staged files..."
13+ ESLINT_OUTPUT=$( npx eslint $STAGED_FILES 2>&1 )
14+ ESLINT_EXIT_CODE=$?
15+
16+ # If ESLint found errors, show them and exit with error
17+ if [ $ESLINT_EXIT_CODE -ne 0 ]; then
18+ echo " ❌ ESLint found errors in staged files:"
19+ echo " $ESLINT_OUTPUT "
20+ echo " Please fix the errors above before committing."
21+ exit 1
22+ fi
23+
24+ echo " ✅ ESLint passed!"
25+ exit 0
Original file line number Diff line number Diff line change 1414 "main" : " src/api/index.js" ,
1515 "bin" : " src/cmd/index.js" ,
1616 "scripts" : {
17+ "preinstall" : " if [ -d .git ]; then git config core.hooksPath .githooks; fi" ,
1718 "install" : " echo install hook override to avoid npm default hook calling node-gyp" ,
1819 "build" : " npm run build:native" ,
1920 "build:native" : " node-gyp configure && node-gyp build" ,
You can’t perform that action at this time.
0 commit comments