Commits
Commitlint
(opens in a new tab) makes sure you are following the rules of
conventional-commits
(opens in a new tab)
Schema: <type>(<scope?>): <message>
In combination withhusky
(opens in a new tab) we can use Git hooks like pre-commit
and
commit-msg
to lint the commit and its message.
pre-commit
hook
To ensure a consistent code style, the pre-commit
hook runs ESLint (opens in a new tab). To get more details about
the rules, visit Codestyle and Linting in our docs. It also runs
Prettier (opens in a new tab) (in write-mode) and applies certain rules. At
last, it sorts all package.json
files via sort-package-json
(opens in a new tab).
commit-msg
hook
If the commit message doesn’t follow the convention of conventional-commits, commitlint will error out and husky gives you an idea of what is wrong.