Giter VIP home page Giter VIP logo

commitlint-jira-type's Introduction

Commitlint Jira Type

Continuous Integration npm LICENSE

Check if your commit messages start with a JIRA ticket identifier and a type.

Accepts commit messages like:

PROJECT-1/feat: implemented a new message handler
KEY-729/fix: removed erroneous handling of a key

Getting Started

If you want to lint your commits with jira-type, follow along:

  1. Install Commitlint, Husky and the jira-type dependencies
    npm i @commitlint/cli husky @dwmt/commitlint-plugin-jira-type @dwmt/commitlint-config-jira-type -D
    
  2. Configure commitlint
    // commitlint.config.js
    module.exports = {
      plugins: ['@dwmt/commitlint-plugin-jira-type'],
      extends: ['@dwmt/commitlint-config-jira-type'],
    }
  3. Setup Husky. To lint commits before they are created you can use the commit-msg hook
    mkdir .husky
    npx husky add .husky/commit-msg "npx --no-install commitlint --edit $1"
    

You can find detailed instructions regarding the local setup of Commitlint and Husky at Commitlint Local Setup.

Configurable Rules

jira-type offers the following configurable rules. By customizing these rules, you can define which messages should be accepted and rejected.

jira-type-project-key-enum

An enumeration of accepted JIRA project keys. If the project key within the message is not included, then the message is rejected. By default, the value of this setting is undefined, which means that every key is accepted.

If you want to accept PROJECTA and PROJECTB only:

// commitlint.config.js
module.exports = {
  plugins: ['@dwmt/commitlint-plugin-jira-type'],
  extends: ['@dwmt/commitlint-config-jira-type'],
  rules: {
     // 2 sets the level of this rule to error.
     // always means that this rule should be applied as is
     // (the other value is "never", which inverts the rule) 
     'jira-type-project-key-enum': [2, 'always', ['PROJECTA', 'PROJECTB']] 
  }
}

jira-type-type-enum

An enumeration of accepted types. If the type within the message is not included, then the message is rejected. By default, the value of this setting is undefined, which means that every type is accepted.

If you want to accept feat and fix only:

// commitlint.config.js
module.exports = {
  plugins: ['@dwmt/commitlint-plugin-jira-type'],
  extends: ['@dwmt/commitlint-config-jira-type'],
  rules: {
     // 2 sets the level of this rule to error.
     // always means that this rule should be applied as is
     // (the other value is "never", which inverts the rule) 
     'jira-type-type-enum': [2, 'always', ['feat', 'fix']] 
  }
}

Packages

This is a monorepo containing the following packages:

commitlint-jira-type's People

Contributors

battila7 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pqminh asepmoels

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.