Skip to content

Instantly share code, notes, and snippets.

@lafarer
Last active April 13, 2023 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lafarer/741a0e99335f8a76424a71920b1ce047 to your computer and use it in GitHub Desktop.
Save lafarer/741a0e99335f8a76424a71920b1ce047 to your computer and use it in GitHub Desktop.
Conventional commits - Linting commit message
#!/usr/bin/env bash
# https://conventionalcommits.org
# https://www.freecodecamp.org/news/how-to-use-commitlint-to-write-good-commit-messages/
# Initialize git repository
git init
# Initialize node project
yarn init -y
# Initialize commitlint
yarn add @commitlint/cli @commitlint/config-conventional --dev
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
# Initialize husky
npx husky-init -y
rm .husky/pre-commit
# Add pre-commit hook
npx husky add .husky/commit-msg "npx --no -- commitlint --edit $1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment