4.0.1 • Published 2 months ago

commitlint-plugin-function-rules v4.0.1

Weekly downloads
21,207
License
GPL-3.0-or-later
Repository
github
Last release
2 months ago

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

Install

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

Usage

Use this plugin in your project's commitlint configuration by specifying it as item in the plugins array. All rules have same name as rules that are available in commitlint, but with the function-rules prefix. The example commitlint.config.js, or commitlint.config.cjs if the package is an ES module, shows the usage of a function rule.

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
      'always',
      (parsed) => {
        // Allow longer headers for commits with "deps" scope.
        if (parsed.scope === 'deps' && parsed.header.length <= 200) {
          return [true];
        }
        return [false, 'deps header must not be longer than 200 characters'];
      },
    ],
  },
};

Contributing

Please create an issue if you have a bug report or feature proposal, or create a discussion if you have a question. If you like this project, please consider giving it a star ⭐

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

Conventional Commits: 1.0.0 XO code style Code style

Security policy

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

License

This project is licensed under the GPLv3 license.

Copyright © 2020-2024 Jeroen de Bruijn

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 http://www.gnu.org/licenses/.

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

4.0.1

2 months ago

4.0.0

9 months ago

4.0.0-beta.2

9 months ago

4.0.0-beta.1

9 months ago

3.1.0

10 months ago

3.0.0

1 year ago

2.0.2

2 years ago

2.0.1-beta.2

2 years ago

2.0.1-beta.3

2 years ago

2.0.1-beta.1

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.0-beta.2

2 years ago

2.0.0-beta.1

2 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.2

4 years ago

1.2.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.12

4 years ago

1.1.13

4 years ago

1.1.11

4 years ago

1.1.8

4 years ago

1.1.10

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago