|
| 1 | +// Credit: @ONEARMY/community-platform |
| 2 | +// https://github.com/ONEARMY/community-platform/blob/master/commitlint.config.js |
| 3 | + |
| 4 | +/* global module */ |
1 | 5 | module.exports = {
|
2 |
| - extends: [], |
3 |
| - rules: { |
4 |
| - "header-min-length": [2, "always", 15], |
5 |
| - "header-case-start-capital": [2, "always"], |
6 |
| - "header-end-period": [2, "always"], |
7 |
| - }, |
8 |
| - plugins: [ |
9 |
| - { |
10 |
| - rules: { |
11 |
| - "header-case-start-capital": ({ raw }) => { |
12 |
| - return [ |
13 |
| - /^[A-Z]/.test(raw), |
14 |
| - "Commit message must start with a capital letter.", |
15 |
| - ]; |
16 |
| - }, |
17 |
| - "header-end-period": ({ header }) => { |
18 |
| - return [/\.$/.test(header), "Commit message must end with a period"]; |
| 6 | + extends: ["@commitlint/config-conventional"], |
| 7 | + /** Add optional custom formatter */ |
| 8 | + // Temporarily removed due to unresolved error: https://app.circleci.com/pipelines/github/ONEARMY/community-platform/5891/workflows/59757a07-b416-43be-9a57-eedc1190d5a0/jobs/44654 |
| 9 | + // formatter: path.resolve(__dirname, 'commitlint.format.ts'), |
| 10 | + /** Add optional override rules (https://www.npmjs.com/package/@commitlint/config-conventional) */ |
| 11 | + // rules: {}, |
| 12 | + helpUrl: |
| 13 | + "run `npm commit` for interactive prompt or see examples at\nhttps://www.conventionalcommits.org", |
| 14 | + // Interactive prompts, called via `yarn commit` |
| 15 | + prompt: { |
| 16 | + settings: {}, |
| 17 | + messages: { |
| 18 | + skip: ":skip", |
| 19 | + max: "upper %d chars", |
| 20 | + min: "%d chars at least", |
| 21 | + emptyWarning: "can not be empty", |
| 22 | + upperLimitWarning: "over limit", |
| 23 | + lowerLimitWarning: "below limit", |
| 24 | + }, |
| 25 | + |
| 26 | + questions: { |
| 27 | + type: { |
| 28 | + description: "Select the type of change that you're committing:", |
| 29 | + enum: { |
| 30 | + feat: { |
| 31 | + description: "A new feature", |
| 32 | + title: "Features", |
| 33 | + emoji: "✨", |
| 34 | + }, |
| 35 | + fix: { |
| 36 | + description: "A bug fix", |
| 37 | + title: "Bug Fixes", |
| 38 | + emoji: "🐛", |
| 39 | + }, |
| 40 | + docs: { |
| 41 | + description: "Documentation only changes", |
| 42 | + title: "Documentation", |
| 43 | + emoji: "📚", |
| 44 | + }, |
| 45 | + style: { |
| 46 | + description: |
| 47 | + "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", |
| 48 | + title: "Styles", |
| 49 | + emoji: "💎", |
| 50 | + }, |
| 51 | + refactor: { |
| 52 | + description: |
| 53 | + "A code change that neither fixes a bug nor adds a feature", |
| 54 | + title: "Code Refactoring", |
| 55 | + emoji: "📦", |
| 56 | + }, |
| 57 | + perf: { |
| 58 | + description: "A code change that improves performance", |
| 59 | + title: "Performance Improvements", |
| 60 | + emoji: "🚀", |
| 61 | + }, |
| 62 | + test: { |
| 63 | + description: "Adding missing tests or correcting existing tests", |
| 64 | + title: "Tests", |
| 65 | + emoji: "🚨", |
| 66 | + }, |
| 67 | + build: { |
| 68 | + description: |
| 69 | + "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)", |
| 70 | + title: "Builds", |
| 71 | + emoji: "🛠", |
| 72 | + }, |
| 73 | + ci: { |
| 74 | + description: |
| 75 | + "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)", |
| 76 | + title: "Continuous Integrations", |
| 77 | + emoji: "⚙️", |
| 78 | + }, |
| 79 | + chore: { |
| 80 | + description: "Other changes that don't modify src or test files", |
| 81 | + title: "Chores", |
| 82 | + emoji: "♻️", |
| 83 | + }, |
| 84 | + revert: { |
| 85 | + description: "Reverts a previous commit", |
| 86 | + title: "Reverts", |
| 87 | + emoji: "🗑", |
| 88 | + }, |
19 | 89 | },
|
20 | 90 | },
|
| 91 | + scope: { |
| 92 | + description: |
| 93 | + "What is the scope of this change (e.g. component or file name)", |
| 94 | + }, |
| 95 | + subject: { |
| 96 | + description: |
| 97 | + "Write a short, imperative tense description of the change", |
| 98 | + }, |
| 99 | + body: { |
| 100 | + description: "Provide a longer description of the change", |
| 101 | + }, |
| 102 | + isBreaking: { |
| 103 | + description: "Are there any breaking changes?", |
| 104 | + }, |
| 105 | + breakingBody: { |
| 106 | + description: |
| 107 | + "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself", |
| 108 | + }, |
| 109 | + breaking: { |
| 110 | + description: "Describe the breaking changes", |
| 111 | + }, |
| 112 | + isIssueAffected: { |
| 113 | + description: "Does this change affect any open issues?", |
| 114 | + }, |
| 115 | + issuesBody: { |
| 116 | + description: |
| 117 | + "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself", |
| 118 | + }, |
| 119 | + issues: { |
| 120 | + description: 'Add issue references (e.g. "fix #123", "re #123".)', |
| 121 | + }, |
21 | 122 | },
|
22 |
| - ], |
| 123 | + }, |
23 | 124 | };
|
0 commit comments