TypeScript icon, indicating that this package has built-in type declarations

    1.7.1 • Public • Published

    commitlint plugin function rules

    commitlint plugin to use functions as rule value.

    • Create custom function, sync or async, as rule value.
    • Create rules that are based on the commit message.
    • Write rules with regular expressions.
    • Use the same rules that are available in commitlint.

    npm version npm downloads Node.js version support Renovate enabled semantic-release Code coverage License

    Table of contents


    npm install --save-dev commitlint-plugin-function-rules @commitlint/cli


    Use this plugin in your project's commitlint configuration by specifying it as item in the plugins array. All rules have same name as the commitlint rules, but with the function-rules prefix.

    Note: The available rules are the same as in commitlint, so it is recommended to disable the commitlint rule when specifying a function rule to avoid undefined behaviour.

    module.exports = {
      extends: ['@commitlint/config-conventional'],
      plugins: ['commitlint-plugin-function-rules'],
      rules: {
        'header-max-length': [0], // level: disabled
        'function-rules/header-max-length': [
          2, // level: error
          (parsed) => {
            if (parsed.type === 'chore' && parsed.header.length < 20) {
              return [true];
            return [false, 'chore header must not be longer than 120 characters'];



    Please create an issue if you have a bug report, feature proposal or question that does not yet exist.

    Please give this project a star if you like it and consider becoming a sponsor to support this project.

    Refer to the contributing guide detailed information about other contributions, like pull requests.

    Conventional Commits: 1.0.0 Code style Linting Lint commit messages Build

    Security policy

    Please refer to the Security Policy on GitHub for the security policy.


    This project is licensed under the GPLv3 license.

    Copyright © 2020-2021 Jeroen de Bruijn

    License details.

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program. If not, see

    The full text of the license is available in the LICENSE file in this repository and online.


    npm i commitlint-plugin-function-rules

    DownloadsWeekly Downloads






    Unpacked Size

    45.4 kB

    Total Files


    Last publish


    • jdbruijn