Examples
commitlint
This guide will help you in the setup of a hook a hook for linting your commits with commitlint
Prerequisite for Commitlint
- You have installed
Gookme
- You have installed and configured commitlint
- You have setup
Gookme
usinggookme init
(see get started if needed)
Hook for Commitlint
In the global hooks folder of your project hooks/commit-msg.json
add the following configuration :
hooks/commit-msg.json
{
"steps": [
// ...
// your other steps
{
"name": "commit lint",
"command": "cat {args} | ./node_modules/@commitlint/cli/cli.js"
}
// ...
// your other steps
]
}
eslint
This guide will help you in the setup of a hook for linting your code with eslint
Prerequisite for Eslint
- You have installed
mookme
- You have installed and configured eslint
- You have setup
mookme
usingnpx mookme init
(see getting started if needed)
Hook for Eslint
- In the hooks folder of the package you want to lint with
eslint
<project-root>/<package>/.hooks/commit-msg
add the following configuration :
hooks/commit-msg.json
{
"steps": [
// ...
// your other steps
{
"name": "eslint",
"command": "./node_modules/eslint/bin/eslint.js ."
}
// ...
// your other steps
]
}
Alternative: setup a npm
script and directly invoke eslint
in the command field :