Skip to content

Commit 6a6a4e4

Browse files
chore: add commit message templates and rules for consistency (#1523)
Co-authored-by: Mariano Fuentes <marfuen98@gmail.com>
1 parent 83972c0 commit 6a6a4e4

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

.cursorrules

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Commit Message Rules
2+
3+
When generating commit messages, ALWAYS follow the Conventional Commits specification:
4+
5+
## Format
6+
7+
`<type>(<scope>): <description>`
8+
9+
## Types (use exactly these):
10+
11+
- feat: A new feature
12+
- fix: A bug fix
13+
- docs: Documentation only changes
14+
- style: Changes that do not affect the meaning of the code (formatting, missing semi-colons, etc)
15+
- refactor: A code change that neither fixes a bug nor adds a feature
16+
- perf: A code change that improves performance
17+
- test: Adding missing tests or correcting existing tests
18+
- build: Changes that affect the build system or external dependencies
19+
- ci: Changes to CI configuration files and scripts
20+
- chore: Other changes that don't modify src or test files
21+
- revert: Reverts a previous commit
22+
23+
## Rules:
24+
25+
1. Use lowercase for type
26+
2. Scope is optional but recommended (e.g., auth, api, ui, db)
27+
3. Description must be in imperative mood ("add" not "added" or "adds")
28+
4. Description must start with lowercase
29+
5. No period at the end of the description
30+
6. Keep the first line under 72 characters
31+
32+
## Examples:
33+
34+
- ✅ feat(auth): add social login with Google OAuth
35+
- ✅ fix(api): resolve race condition in user update endpoint
36+
- ✅ chore: update dependencies to latest versions
37+
- ✅ docs(readme): add installation instructions for Windows
38+
- ❌ Added new feature (missing type)
39+
- ❌ feat: Added login (wrong tense, capitalized)
40+
- ❌ fix(api): fixes bug. (wrong tense, has period)

.gitmessage

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# <type>(<scope>): <subject>
2+
#
3+
# <body>
4+
#
5+
# <footer>
6+
#
7+
# Type must be one of the following:
8+
# * feat: A new feature
9+
# * fix: A bug fix
10+
# * docs: Documentation only changes
11+
# * style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
12+
# * refactor: A code change that neither fixes a bug nor adds a feature
13+
# * perf: A code change that improves performance
14+
# * test: Adding missing tests or correcting existing tests
15+
# * build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
16+
# * ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
17+
# * chore: Other changes that don't modify src or test files
18+
# * revert: Reverts a previous commit
19+
#
20+
# Scope is optional and can be anything specifying the place of the commit change.
21+
# For example: auth, api, ui, db, etc.
22+
#
23+
# Subject must:
24+
# * use the imperative, present tense: "change" not "changed" nor "changes"
25+
# * don't capitalize the first letter
26+
# * no dot (.) at the end
27+
#
28+
# Body should include the motivation for the change and contrast this with previous behavior.
29+
#
30+
# Footer should contain any information about Breaking Changes and is also the place to
31+
# reference GitHub issues that this commit closes.
32+
#
33+
# Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines.
34+
# The rest of the commit message is then used for this.
35+
#
36+
# Example:
37+
# feat(auth): add OAuth2 integration
38+
#
39+
# Add support for OAuth2 authentication with Google and GitHub providers.
40+
# This allows users to sign in using their existing accounts.
41+
#
42+
# Closes #123

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx commitlint --edit $1

0 commit comments

Comments
 (0)