Explorar o código

Add Folder Pattern to linting

Change-Id: I0dcae2d83e9827b8b57da6181c234f805b4bf6f2
tabraiz hai 1 ano
pai
achega
0c21d58a1f
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      tools/git-hooks/pre-commit

+ 7 - 4
tools/git-hooks/pre-commit

@@ -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