|
| 1 | +const HEADERLENGTHMAX = 60; |
| 2 | +const LINELENGTHMAX = 72; |
| 3 | +const BODYLENGTHMIN = 15; |
| 4 | + |
| 5 | +module.exports = { |
| 6 | + parserPreset: './.commitlint-parser-preset', |
| 7 | + rules: { |
| 8 | + |
| 9 | + // Body |
| 10 | + 'body-leading-blank': [2, 'always'], // blank line between header and body |
| 11 | + 'body-empty': [2, 'never'], // body cannot be empty |
| 12 | + 'body-max-line-length': [2, 'always', LINELENGTHMAX], // body lines max chars LINELENGTHMAX |
| 13 | + 'body-min-length' : [2, 'always', BODYLENGTHMIN], // body more than BODYLENGTHMIN chars |
| 14 | + |
| 15 | + // Footer |
| 16 | + 'footer-leading-blank': [2, 'always'], // blank line between body and footer |
| 17 | + 'footer-max-line-length': [2, 'always', LINELENGTHMAX], // footer lines max chars LINELENGTHMAX |
| 18 | + |
| 19 | + // Header |
| 20 | + 'header-case': [2, 'always', 'lower-case'], // header lower case |
| 21 | + 'header-max-length': [2, 'always', HEADERLENGTHMAX], // header max chars HEADERLENGTHMAX |
| 22 | + |
| 23 | + // Scope |
| 24 | + 'scope-empty': [2, 'never'], // scope always |
| 25 | + 'scope-enum': [ |
| 26 | + 2, |
| 27 | + 'always', |
| 28 | + [ |
| 29 | + 'front', // Front-End change |
| 30 | + 'back', // Back-End change |
| 31 | + 'infra', // Infrastructure change |
| 32 | + 'conf', // Configuration files change |
| 33 | + 'build', // System component change (ci, scons, webpack...) |
| 34 | + 'job', // asynchronous or schedule tasks (backups, maintainance...) |
| 35 | + 'cross', // Mix of two or more scopes |
| 36 | + 'doc', // Documentation only changes |
| 37 | + ], |
| 38 | + ], |
| 39 | + |
| 40 | + // Subject (commit title without type and scope) |
| 41 | + 'subject-case': [2, 'always', 'lower-case'], // subject lower-case |
| 42 | + 'subject-empty': [2, 'never'], // subject always |
| 43 | + |
| 44 | + // Type |
| 45 | + 'type-empty': [2, 'never'], //type always |
| 46 | + 'type-enum': [ |
| 47 | + 2, |
| 48 | + 'always', |
| 49 | + [ |
| 50 | + 'feat', // New feature |
| 51 | + 'perf', // Improves performance |
| 52 | + 'fix', // Bug fix |
| 53 | + 'rever', // Revert to a previous commit in history |
| 54 | + 'style', // Do not affect the meaning of the code (formatting, etc) |
| 55 | + 'refac', // Neither fixes a bug or adds a feature |
| 56 | + 'test', // Adding missing tests or correcting existing tests |
| 57 | + ], |
| 58 | + ], |
| 59 | + }, |
| 60 | +}; |
0 commit comments