How do you enforce conventional commits or commitlint rules? Follow:
Short answer: Conventional Commits define a standard format for commit messages, such as: feat: add new user registration flow fix: correct login validation chore: update dependencies To enforce this automatically, use commitlint with husky: Setup: npm install --save-dev @commitlint/{config-conventional,cli} husky Create a commitlint.config.js:… module.exports = {……… extends: ['@commitlint/config-conventional'] }; Then add a Git…
Explain a bit more
hook: npx husky install npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"' Now every commit is checked — bad messages are rejected.
Real-world example (ShopNest)
Prefer clear commits: fix(cart): prevent negative quantities instead of update.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png