EandrewJones commented on issue #446:
URL: 
https://github.com/apache/flagon-useralejs/issues/446#issuecomment-2103132205

   Decent blog for setting up eslint and prettier:
   
[https://blog.logrocket.com/linting-typescript-eslint-prettier/](https://blog.logrocket.com/linting-typescript-eslint-prettier/)
   
   Example of a `pre-commit` script from my previous start up:
   ```sh
   #!/bin/sh
   . "$(dirname "$0")/_/husky.sh"
   
   echo '๐Ÿ—๏ธ๐Ÿ‘ท Styling, testing and building your project before committing'
   
   # Check Prettier standards
   yarn run check-format ||
   (
       echo "๐Ÿ™ˆ Afraid to look! Your styling needs fixing. ๐Ÿ™ˆ
       Prettier Check Failed. Run yarn run format, add changes and try commit 
again.";
       false;
   )
   
   # Check ESLint Standards
   yarn run check-lint ||
   (
       echo '๐Ÿ˜ค๐Ÿ˜ก๐Ÿ˜ค Your failure to adhere to our standards is disappointing. Try 
again. ๐Ÿ˜ค๐Ÿ˜ก๐Ÿ˜ค
       ESLint Check Failed. Make the required changes listed above, add changes 
and try to commit again.'
       false;
   )
   
   # Check tsconfig standards
   yarn run check-types ||
   (
       echo 'โŒ๐Ÿ” Upon closer inspection, your Types failed. ๐Ÿ”ŽโŒ
       Are you seriously trying to write that? Make the changes required above.'
       false;
   )
   
   # If everything passes... Now we can commit
   echo '๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”... Alright... Code looks good to me... Trying to build now. ๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”'
   
   yarn run build ||
   (
       echo 'โŒ๐Ÿ‘ท๐Ÿ”จโŒ Better call Bob... Because your build failed โŒ๐Ÿ‘ท๐Ÿ”จโŒ
               Vite build failed: View the errors above to see why.
       '
       false;
   )
   
   # After build, run unit tests
   # Right now, runs all tests. Later scope to just unit tets, we can add 
e2e/integration as github actions on merge
   yarn run test ||
   (
        echo '๐Ÿงช๐Ÿ’ฅ๐Ÿงช๐Ÿ’ฅ Uh oh! Looks like you broke something or failed to write 
tests ๐Ÿงช๐Ÿ’ฅ๐Ÿงช๐Ÿ’ฅ
                Cypress tests failed: View the logs to see what broke and fix 
it before re-committing.
       '
       false;
   )
   
   # If everything passes... Now we can commit
   echo 'โœ…๐Ÿš€โœ…๐Ÿš€ QuestStudio approves... Your contribution is appreciated and 
accepted for commit. โœ…๐Ÿš€โœ…๐Ÿš€'
   ```
   
   Obviously, need to switch from `yarn` --> `npm` and change some of the 
messaging/comments.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org
For additional commands, e-mail: notifications-h...@flagon.apache.org

Reply via email to