Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rules via commitlint #35

Open
ewolfe opened this issue Mar 19, 2018 · 8 comments
Open

Add support for rules via commitlint #35

ewolfe opened this issue Mar 19, 2018 · 8 comments
Assignees

Comments

@ewolfe
Copy link
Owner

ewolfe commented Mar 19, 2018

Here are some examples

https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/index.js

@ewolfe ewolfe self-assigned this Mar 21, 2018
@mrchief
Copy link
Collaborator

mrchief commented Jan 21, 2019

You probably don't need this if you always follow branch > pr > merge to master flow as PRLint will ensure the commit messages to master (which is the PR title) follows conventional-commit spec. Individual branch commit messages can remain flexible.

@ewolfe
Copy link
Owner Author

ewolfe commented Jan 22, 2019

My goal was to expose the same DSL instead of forcing regex upon users.

Side note: the PR title changes based on the number of commits in the pull request. 1 commit and the title is the commit message, 2 or more commits and the title is the branch name. I wish the title was ALWAYS the branch name. I started a project called github-ui-hooks that was supposed to be a chrome extension that would change the behavior of github. One of these days I'll find the time to fully release it :)

@mrchief
Copy link
Collaborator

mrchief commented Jan 22, 2019

My goal was to expose the same DSL instead of forcing regex upon users.

Oh, I get it, yeah that would be a welcome addition if this can support a lintrc file. Makes it easier to adopt.

@mrchief
Copy link
Collaborator

mrchief commented Feb 10, 2019

Once #96 is merged, we can look for this file first, followed by prlint.json followed by default config. I'm thinking to have lint.js and commitlint.js (for lack of better names) in src\core which can house linting logic and linter.js (name subject to change) can delegate validation to one those based on the file found. Just thinking out loud here, not a well thought out plan. Thoughts?

@ewolfe
Copy link
Owner Author

ewolfe commented Feb 10, 2019

We could probably keep it all in prlint.json:

{
  "title": [
    {
      "pattern": "^(build|ci|docs|feat|fix|perf|refactor|style|test):\\s",
      "message": "Your title needs to be prefixed with a topic"
    },
+   {
+     "rules": {
+       "header-max-length": [0, "always", 72],
+     },
+     "message": "Your title needs to be less than 72 characters"
+   }
  ]
}

@mrchief
Copy link
Collaborator

mrchief commented Feb 11, 2019

We could probably keep it all in prlint.json:

Yes, but then commitlint will not be able to find those. This might be a good time to open a dialog with commitlint folks if you deem fit.

@ewolfe
Copy link
Owner Author

ewolfe commented Feb 11, 2019

Looks like https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/lint would do the job.

@mrchief
Copy link
Collaborator

mrchief commented May 20, 2019

I recently modified my internal lambda to lint commits using commitlint.config.json. I did think about adding rules to prlint.json but that doesn't work with cli tools, extensions, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants