Socket
Socket
Sign inDemoInstall

commitlint-config-karpo

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    commitlint-config-karpo

Commitlint shareable configuration for karpo


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

commitlint-config-karpo

本包提供了karpo配套的 commitlint 可共享配置,用于对 git commit message 进行校验。

安装

除了本包,你需要同时安装 @commitlint/cli:

#npm
npm install commitlint-config-karpo @commitlint/cli --save-dev

# 或者
yarn add -D commitlint-config-karpo @commitlint/cli

使用

在你的 .commitlint.config.js 中继承本包:

module.exports = {
  extends: ['karpo'],
};

设置 git hook

可通过 husky 设置在 git commit 时触发 commitlint。

husky(V4.x):

npm install husky@4.3.5 --save-dev

或者

yarn add -D husky@4.3.5

然后在 package.json 中增加:

{
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}

husky(V4.x以上):

安装husky

npm install husky --save-dev
或者
yarn add -D husky

在 package.json 中增加如下配置

"scripts": {
 		"prepare": "husky install"
 }

添加hooks

npx husky add .husky/commit-msg "npx --no-install commitlint --edit '$1'"
git add .husky/commit-msg

.husky/commit-msg文件内容如下

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"

更多信息可参考 commitlint 文档

参考

  1. commitlint rule

Keywords

FAQs

Last updated on 11 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc