#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

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

# Check ESLint Standards
npm run all:lint:check ||
(
    echo '🔨❌ Yoo, you have linting problem in your code 🔨❌
          Run npm run lint, add changes and try commit again.';
    false;
)

echo '🎉 No TypeScript lint errors found: ... ✨🚀🏄‍♂️🍻'

npm run contracts:lint ||
(
    echo '🔨❌ Yoo, you have linting problem in your contract code 🔨❌
          Run npm run contracts:lint, add changes and try commit again.';
    false;
)

echo '🎉 No contracts lint errors found: ... ✨🚀🏄‍♂️🍻'

npm run all:prettier:check ||
(
   echo '🔨❌ Prettier validation failed 🔨❌
         Run npm run all:prettier:write manually to fix your issues or add changes and try commit again.
            You can validate code format by running npm run all:prettier:check';
   false;
)
