#!/bin/bash

# Redirect output to stderr.
exec 1>&2
echo "INFO: pre-commit: checking if sources are formatted correctly"

npm run check-format
RESULT=$?

if [ "$RESULT" != "0" ]; then
    echo "INFO: pre-commit: npm run check-format failed"
    echo "FAIL: pre-commit: aborting the commit"
    exit $RESULT
fi

exit $RESULT
