Skip to content

Instantly share code, notes, and snippets.

@shubhamp-sf
Last active May 21, 2024 07:29
Show Gist options
  • Save shubhamp-sf/47bddd8d64d7b784a1e923419e04bdd8 to your computer and use it in GitHub Desktop.
Save shubhamp-sf/47bddd8d64d7b784a1e923419e04bdd8 to your computer and use it in GitHub Desktop.
  1. install commitlint cli
npm install --save-dev @commitlint/config-conventional @commitlint/cli
  1. Add convention configuration to project
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
  1. Install Husky
npm install husky --save-dev
  1. Install Hook
npx husky install
  1. Add Hook
cat <<EEE > .husky/commit-msg
#!/bin/sh
. "\$(dirname "\$0")/_/husky.sh"

npx --no -- commitlint --edit "\${1}"
EEE
  1. Make Hook Executable
chmod a+x .husky/commit-msg
@effemmeffe
Copy link

Thanks, it's really clear now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment