JS Project Template
7 August 2020
The template itself can be found on my GitHub at jackleslie/js.
This template is suited for those who like to rely on Git Hooks as a part of their development pipeline - to enable this I use Husky in order to define three hooks: pre-commit, commit-msg and pre-push.
Once the staged files have been successfully linted and formatted I check that the commit message conforms to the Conventional Commits standard. To do this I run the commitlint command which used the standard configuration found in the package.json file.
After one or many meaningful commits the code can only be pushed if all tests pass, which are run with Jest. This means that there will never be code on another machine that does not fully conform to the project's test suite. To avoid this becoming a development bottleneck (i.e realising that lots of tests fail after many commits) there is an NPM script to run Jest in watch mode so that you can ensure tests are passing before you try to push.
Outside of these Git Hooks, VSCode will take into account the ESLint and Prettier configuration to display errors during development. Also, Babel is used when building the code so that if it's to be distributed on NPM it will have all the necessary polyfills and translilation performed on it.