devfolioco / devfolio-gatsby-starter

Kickstart landing page development with GatsbyJS
MIT License
23 stars 94 forks source link

Automatically Prettify and Lint after every commit using Husky and Lint-Staged #100

Open nirmalhk7 opened 4 years ago

nirmalhk7 commented 4 years ago

Currently we're required to run npm run format to prettify the entire code and npm run lint:fix to fix the code. However, we can use Husky and lint-staged to automatically format those files which are staged into Git, making it more convenient.

We add Husky (which is a git hooks implementation for NodeJS projects) to execute our commands after pre-commit. We use lint-staged to filter out files which are in our staging area, and run our Prettify and ESLint commands there. This automation will massively increase code-maintenance in the future.

I'd like to implement this issue myself. Please let me know if its suitable.