Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pre-commit 838 B
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# npx --no -- commitlint --edit ${1}

echo '🏗️👷 Styling your project before committing👷‍♂️🏗️'
echo 'please be patient, this may take a while...'

# Check ESLint and Prettier Standards
npm run format ||
(
    echo '🔨❌ Yoo, you have a problem in your code. Check linter and prettier 🔨❌
          Run npm run format:fix, add changes and try commit again.';
    false;
)

# Check tsconfig Standards
npm run check-types ||
(
    echo '😂❌ Failed type check. 😂❌
            Please correct the types and try commit again.'
    false;
)

# Check Tests in Jest
npm run test ||
(
    echo '🤡❌ Failed tests. 🤡❌
            Check the test result and fix the tests.'
    false;
)

echo '🎉 No error found: committing this now.... ✨🚀🏄‍♂️🍻'