DEV Community

amiceli
amiceli

Posted on

My script to install husky, commitlint and lint-staged with zx

Hello friends,

In all my projects I use husky, lint-staged and commitlint.

Husky

I love husky ! It helps to create Git hook. I use it for :

  • run eslint with lint-staged before commit
  • commitlint to follow conventionnal commits rules
  • run unit tests before push

lint-staged

lint-staged is useful to run eslint against staged git files.
I love it, with lint-staged your commits contain nice files ;). It's better than one commit called lint all files after all commits ^^.

commitlint

commitlint checks if your commit messages meet the conventionnal commit format.
I discovered conventionnal commit in my company and know I use it in any projects ;).

It's especially useful when we are many developers in a project. It's better than commit like job done, fix something etc ^^.

Installation

To install everything on my projects I create a zx script in my zx-scripts repository.

If you want test it, you can run this script withzx :

zx https://raw.githubusercontent.com/amiceli/zx-scripts/main/index.mjs
Enter fullscreen mode Exit fullscreen mode

If you don't have zx, you can install it with npm : npm i -g zx.

I'm still wording on it to add some args and eslint install.

Ciao friends !

Top comments (0)