-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.mjs
More file actions
78 lines (67 loc) · 2.78 KB
/
commitlint.config.mjs
File metadata and controls
78 lines (67 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Commitlint Configuration
*
* This configuration enforces Conventional Commits standard to maintain a
* structured git history for semantic versioning and automated changelogs.
*
* Rule format: [level, applicable, value]
* Levels: 0 = disabled, 1 = warning, 2 = error
*/
export default {
// Use the conventional commits standard as base configuration
extends: ['@commitlint/config-conventional'],
rules: {
// Require a blank line between subject and body
// Improves readability in git log and changelogs
'body-leading-blank': [1, 'always'],
// Limit body line length to 100 characters for better readability
// in terminals, git UIs, and GitHub displays
'body-max-line-length': [2, 'always', 100],
// Require a blank line before footer section (breaking changes, references)
// Separates footer from body content visually
'footer-leading-blank': [1, 'always'],
// Limit footer line length to 100 characters for consistent display
'footer-max-line-length': [2, 'always', 100],
// Limit header (type(scope): subject) length to 100 characters
// Ensures commit messages are concise and readable in git logs
'header-max-length': [2, 'always', 100],
// Enforce specific casing for subject line
// Prevents capitalized subjects (e.g., "Fixed bug") for consistency
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
// Require a subject line (message after type/scope)
// Ensures descriptive commit messages
'subject-empty': [2, 'never'],
// Prevent trailing period in subject line
// Maintains consistent formatting
'subject-full-stop': [2, 'never', '.'],
// Enforce lowercase for commit type (feat, fix, etc.)
// Ensures visual consistency across commits
'type-case': [2, 'always', 'lower-case'],
// Require commit type to be specified
// Critical for automated semantic versioning
'type-empty': [2, 'never'],
// Define allowed commit types
// Categorizes changes for semantic versioning and release notes
'type-enum': [
2,
'always',
[
'build', // Changes to build system or external dependencies
'chore', // Maintenance tasks, dependency updates, etc.
'ci', // Changes to CI configuration and scripts
'docs', // Documentation updates only
'feat', // New features (triggers MINOR version in semver)
'fix', // Bug fixes (triggers PATCH version in semver)
'perf', // Performance improvements
'refactor', // Code changes that neither fix bugs nor add features
'revert', // Reverts a previous commit
'style', // Code style changes (whitespace, formatting, etc.)
'test', // Adding or correcting tests
],
],
},
};