Commitlint: Custom rules support?

Created on 11 Jan 2018  路  7Comments  路  Source: conventional-changelog/commitlint

I really like this project, I wrote a commit message validator for my company a while back and while it has served its purpose it is not very robust.

I see this project follows a eslint style approach with shareable configs and rules, which I really like. Does it also support custom rules? I read the docs and search the issues and did not see anything referring to this, but I could also be blind.

Most helpful comment

I created the start of an PR in porting over almost exactly how eslint does this as it seemed pretty simple.

All 7 comments

Glad you like commitlint :)

Currently there is no support for custom rules / plugins in commitlint.

At some point I want the tool to support this, but currently this is completely in the vague idea phase.

Closing this for now.

@marionebl Do you mind if I have a go at this? For me I want a rule to validate the conventional-commit "BREAKING CHANGE: followed by a single space or 2 new lines" rule which to me doesn't seem like something that should be in the main repo itself, but as a plugin rule, it would be more suitable.

I'm thinking it would be good to implement this similar to how eslint works? Package names with commitlint-plugin-XXX or by specifying a specific full package name my-custom-commit-linting-packages.

From what I can see this would be a case of some special requires in this file along with getting the plugins off the opts param (or a new param? this seems to be the main usage of lint (link)) and merging with implementations; https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/lint/src/index.js

I created the start of an PR in porting over almost exactly how eslint does this as it seemed pretty simple.

@SimeonC @marionebl good day, did we publish this feature in npm?
https://github.com/conventional-changelog/commitlint/commit/cea4564d71b6d5c72f9689dc05d783dd2e3a4b13

Seems like the latest release happened 3 months ago
https://www.npmjs.com/package/@commitlint/cli/v/7.5.2

thanks if published

@blackswanny it's not yet released. We will release a new version soon. You could watch releases to get a notification.

Hello guys, I opened a new pr that allows you to define a local plugin inside the tool. Without the need to publish to npm, please take a look :) https://github.com/conventional-changelog/commitlint/pull/1692

Was this page helpful?
0 / 5 - 0 ratings