1.0.0 • Published 9 months ago

@itaober/commitlint-config v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@itaober/commitlint-config

English | 简体中文

Introduction

@itaober/commitlint-config provides a set of predefined commitlint rules and configurations to help maintain consistent commit message standards.

Installation

pnpm add @commitlint/cli @itaober/commitlint-config -D

Usage

Please refer to the Commitlint Official Configuration Documentation.

Create a commitlint.config.js or commitlint.config.ts configuration file in your project root directory:

export default {
  extends: ['@itaober/commitlint-config'],
  // custom configurations
};

Commit Message Validation with Git Hooks

To automatically check commit messages before they are created, you can use this configuration with simple-git-hooks:

  1. Install the required packages:
pnpm add simple-git-hooks lint-staged -D
  1. Add the following config to your package.json:
{
  "simple-git-hooks": {
    "commit-msg": "npx --no-install commitlint --edit $1"
  }
}
  1. Add simple-git-hooks initialization to the prepare script in package.json:
"scripts": {
  "prepare": "simple-git-hooks"
}
  1. Run pnpm prepare to initialize simple-git-hooks:
pnpm prepare

Rules

This configuration enforces the following commit message format:

type(scope?): subject

body?

footer?

Example:

git commit -m "feat: add new feature"

Types

  • init: Initial commit
  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • release: Create a release commit

License

License MIT

1.0.0

9 months ago

0.1.0-alpha.1

9 months ago