Nondeterministic Programming Methodology

    @amollo-lint/commitlint-plugin-card-id

    1.3.0 • Public • Published

    @amollo-lint/commitlint-plugin-card-id

    MIT License npm version

    recognition and inclusion of the card ID

    Installation

    • npm
    npm install --save-dev @amollo-lint/commitlint-plugin-card-id @commitlint/config-conventional @commitlint/cli
    
    • yarn
    yarn add -D @amollo-lint/commitlint-plugin-card-id @commitlint/config-conventional @commitlint/cli
    

    Usage

    Set your commitlint config to:

    {
        extends: "@commitlint/config-conventional",
        plugins: ["@amollo-lint/commitlint-plugin-card-id"],
        rules: {
            "card-id": [
                2,
                "always",
                {
                    required: true,
                    position: "start",
                    spaceBeforeAfter: "both",
                    prefixId: "c-",
                    borderType: "|",
                    minLengthId: 3,
                    ignoreTypes: ["build", "test", "ci"],
                    log: {
                        message: "Link to the map in trello https://trello.com/c/<trello_id>",
                        onlyId: true,
                        pattern: "<trello_id>"
                    }
                }
            ]
        }
    }

    Example

    $ git commit -m "feat(bar): |c-ES7Mn9Ow| update animation for bar"
    
    Link to the card in trello https://trello.com/c/ES7Mn9Ow

    Options

    position

    Location in the subject of the commit
    accept - "start" and "end"
    default - "start"

    example:

    • start
      • incorrect
        • "<type>(<scope>): initial commit |c-ES7Mn9Ow|"
        • "<type>(<scope>): initial |c-ES7Mn9Ow| commit"
      • correct
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"
    • end
      • incorrect
        • "<type>(<scope>): initial |c-ES7Mn9Ow| commit"
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"
      • correct
        • "<type>(<scope>): initial commit |c-ES7Mn9Ow|"

    ignoreTypes

    Ignoring the card-id rule for comparable types
    accept - string[] | string
    default - []

    example:

    • ["test", "ci"] - required: true
      • incorrect -
        • "fix(<scope>): initial commit"
      • correct
        • "ci(<scope>): initial commit"

    ignoreScopes

    Ignoring the card-id rule for comparable scopes
    accept - string[] | string
    default - []

    example:

    • ["root", "sidebar"] - required: true
      • incorrect -
        • "<type>(otherScope): initial commit"
      • correct
        • "<type>(sidebar): initial commit"

    prefixId

    Prefix for identifier
    accept - string
    default - "c-"

    example:

    • id-
      • incorrect
        • "<type>(<scope>): |ES7Mn9Ow| initial commit"
        • "<type>(<scope>): |id:ES7Mn9Ow| initial commit"
      • correct
        • "<type>(<scope>): |id-ES7Mn9Ow| initial commit"

    borderType

    Card id border type
    accept - string | [string, string]
    acceptSingleValue - "| or ||" | "{ or {}" | "< or <>" | "( or ()"
    default - "|"

    example:

    • { or ["{", "}"]
      • incorrect
        • "<type>(<scope>): [c-ES7Mn9Ow] initial commit"
        • "<type>(<scope>): (c-ES7Mn9Ow) initial commit"
      • correct
        • "<type>(<scope>): {c-ES7Mn9Ow} initial commit"

    minLengthId

    Minimum identifier length
    accept - number
    default - 2

    example:

    • 4
      • incorrect
        • "<type>(<scope>): |c-ES7| initial commit"
      • correct
        • "<type>(<scope>): |c-ES7M| initial commit"

    required

    If true, then the map id must be in the commit subject. If false, validation will only occur when the map id pattern is found in the commit subject
    accept - false or true
    default - true

    example:

    • false - minLengthId: 4
      • incorrect
        • "<type>(<scope>): |c-ES7| initial commit"
      • correct
        • "<type>(<scope>): initial commit"
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"
    • true
      • incorrect
        • "<type>(<scope>): initial commit"
      • correct
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"

    idMatch

    Matching with your own pattern
    accept - RegExp
    default - null

    example:

    • /^\d+$/ - only numbers
      • incorrect
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"
      • correct
        • "<type>(<scope>): |c-4129791| initial commit"

    spaceBeforeAfter

    Space on the sides of the card ID
    accept - "before" | "after" | "both"
    default - if position is equal to start, then "both" otherwise position is equal to end, then "before"

    example:

    • after - position: end
      • incorrect
        • "<type>(<scope>): initial commit |c-ES7Mn9Ow|"
      • correct
        • "<type>(<scope>): initial commit |c-ES7Mn9Ow| "

    headerLikeSubject

    If checking a commit without headers, enable this option so that the commit subject is accepted as the header
    accept - true or false
    default - false

    example:

    • true
      • incorrect
        • "<type>(<scope>): |c-ES7Mn9Ow| initial commit"
      • correct
        • "|c-ES7Mn9Ow| initial commit"

    log

    Displaying a message after a successful commit check
    accept - {message: string, onlyId: boolean, pattern: string} | string
    default - null

    Install

    npm i @amollo-lint/commitlint-plugin-card-id

    DownloadsWeekly Downloads

    0

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    23.7 kB

    Total Files

    16

    Last publish

    Collaborators

    • amollo