0.1.0 • Published 1 year ago
@ruijadom/commitlint-config v0.1.0
@ruijadom/commitlint-config
commitlint
configuration for Ruijadom projects.
Table of Contents
Installation
You can install @ruijadom/commitlint-config
using npm or Yarn.
Using pnpm:
# pnpm
pnpm i -D @ruijadom/commitlint-config @commitlint/cli
# Yarn
yarn add -D @ruijadom/commitlint-config @commitlint/cli
Usage
After installing, apply the configuration to commitlint by creating a .commitlintrc.js file with the following content:
module.exports = {
extends: ['@ruijadom/commitlint-config']
};
Bonus: Commit Linting with Husky
To lint commits before they are created, you can use Husky and set up the 'commit-msg' hook.
Installation:
# pnpm
pnpm i -D husky
# Yarn
yarn add -D husky
Husky v4:
Then, create a .huskyrc file or add the following code to your package.json:
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
Husky v5:
Create a .husky/commit-msg file with the following content:
#!/bin/sh
npx --no-install commitlint --edit $1
# or
# yarn commitlint --edit $1
Make sure to make the script executable using chmod +x .husky/commit-msg.
Version Support
- Node.js LTS >= 10.21.0
- Git >= 2.13.2
License
This project is licensed under the MIT License. See the LICENSE file for details.