mirror of https://github.com/ghostfolio/ghostfolio
5 changed files with 25 additions and 28 deletions
@ -0,0 +1,7 @@ |
|||||
|
# Run lint and abort if there are any lint errors |
||||
|
# --quiet will supress warnings which would cause this check to fail too |
||||
|
# this is temporary until all warnings are fixed |
||||
|
npm run lint --quiet || exit 1 |
||||
|
|
||||
|
# Run format:check on modified and uncommitted files and abort if there are any formatting errors |
||||
|
npm run format:check --uncommitted || exit 1 |
@ -1,26 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
|
|
||||
# Will check if "npm run format" is run before executing. |
|
||||
# Called by "git commit" with no arguments. The hook should |
|
||||
# exit with non-zero status after issuing an appropriate message if |
|
||||
# it wants to stop the commit. |
|
||||
|
|
||||
echo "Running npm run format" |
|
||||
|
|
||||
# Run the command and loop over its output |
|
||||
FILES_TO_STAGE="" |
|
||||
i=0 |
|
||||
while IFS= read -r line; do |
|
||||
# Process each line here |
|
||||
((i++)) |
|
||||
if [ $i -le 2 ]; then |
|
||||
continue |
|
||||
fi |
|
||||
if [[ $line == Done* ]]; then |
|
||||
break |
|
||||
fi |
|
||||
FILES_TO_STAGE="$FILES_TO_STAGE $line" |
|
||||
|
|
||||
done < <(npm run format) |
|
||||
git add $FILES_TO_STAGE |
|
||||
echo "Files formatted. Committing..." |
|
Loading…
Reference in new issue