Skip to content

Commit

Permalink
Linting in pre-commit hook #10483
Browse files Browse the repository at this point in the history
Not everything can be fixed automatically by eslint, but at least we
avoid pushing broken things to CI.
  • Loading branch information
PowerKiKi committed Jul 4, 2024
1 parent 7b293ef commit 8760e3d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bin/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ if [ "$files" != "" ]; then
echo "$files" | xargs git add
fi

files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E 'client/.*\.(html|ts)$')
if [ "$files" != "" ]; then

# Run eslint before commit
printf -- '--lint-file-patterns %s\n' $files | xargs ./node_modules/.bin/ng lint --fix
if [ $? -ne 0 ]; then
pass=false
fi

# Automatically add files that may have been fixed by eslint
echo "$files" | xargs git add
fi

files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(php|phtml)$')
if [ "$files" != "" ]; then

Expand Down

0 comments on commit 8760e3d

Please sign in to comment.