Skip to content

Commit

Permalink
Add Folder Pattern to linting
Browse files Browse the repository at this point in the history
Change-Id: I0dcae2d83e9827b8b57da6181c234f805b4bf6f2
  • Loading branch information
tabraiz authored and bjornalm committed Mar 28, 2024
1 parent f5250cd commit 0c21d58
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ for FILE in `git diff --cached --name-only` ; do
echo -e "[ERROR] $FILE: Found pdb.set_trace() debug statements in file.\n"
fi
elif [[ "$FILE" =~ ^.+(js|jsx|ts|tsx)$ ]]; then
FOLDERS_PATTERN="^(desktop/core/src/desktop/js|tools/sql-docs|tools/jison)/"
echo "Running ESLint for $FILE..."
eslint "$FILE" # Run ESLint for JavaScript/JSX files
if [ $? -ne 0 ]; then
ERRORS=true
echo -e "[ERROR] ESLint found issues in $FILE.\n"
if [[ "$FILE" =~ $FOLDERS_PATTERN ]]; then # Check if file is inside one of the desired folders
eslint "$FILE" # Run ESLint for JavaScript/JSX files
if [ $? -ne 0 ]; then
ERRORS=true
echo -e "[ERROR] ESLint found issues in $FILE.\n"
fi
fi
fi
done
Expand Down

0 comments on commit 0c21d58

Please sign in to comment.