Skip to content

Commit fffd1a7

Browse files
salvar3ngaSergio Alvarenga
andauthored
feat: add commit lint to OpenSCD (openscd#1676)
* feat: add commitlint and husky dependencie * refactor: remove prepare script on pkg.json * docs: create documentation about correctly committing to OpenSCD * docs: move documentation to how-to folder --------- Co-authored-by: Sergio Alvarenga <[email protected]>
1 parent a22a165 commit fffd1a7

File tree

5 files changed

+2277
-235
lines changed

5 files changed

+2277
-235
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
};

docs/how-to/commiting.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# 📝 Commit Message Guidelines
2+
3+
## Purpose
4+
5+
To maintain a clean, readable, and automated commit history, we enforce the [Conventional Commits ↗](https://www.conventionalcommits.org/en/v1.0.0/) specification across this repository.
6+
7+
All commits **must** follow the format described below. Commits that do not comply will be automatically rejected by our Git hooks.
8+
9+
---
10+
11+
## 📋 Commit Format
12+
13+
```
14+
<type>(<scope>): <subject>
15+
```
16+
17+
- `type`: the kind of change you're committing.
18+
- `scope`: the specific part of the codebase affected (optional but encouraged).
19+
- `subject`: a brief description of the change.
20+
21+
---
22+
## ✏️ Examples
23+
24+
Good examples:
25+
```
26+
feat(core): add authentication module
27+
fix(openSCD): resolve login redirect bug
28+
docs: update contributing guidelines
29+
chore: update eslint config
30+
```
31+
32+
Bad examples (these would be rejected):
33+
```
34+
"fix bug"
35+
"updated stuff"
36+
"small changes"
37+
```
38+
39+
---
40+
## 🔖 Some of the allowed Types
41+
42+
⚠️ Disclaimer: For a full list please visit the [conventional commits ↗](https://www.conventionalcommits.org/en/v1.0.0/) page
43+
44+
| Type | Purpose |
45+
|------------|-----------------------------------------------------------|
46+
| feat | A new feature |
47+
| fix | A bug fix |
48+
| docs | Documentation only changes |
49+
| style | Changes that do not affect meaning (formatting, etc.) |
50+
| refactor | Code change that neither fixes a bug nor adds a feature |
51+
| perf | A code change that improves performance |
52+
| test | Adding or correcting tests |
53+
| chore | Maintenance tasks (build process, tooling, dependencies) |
54+
55+
---
56+
57+
## 🧠 Additional Notes
58+
59+
- The commit hook will automatically validate your message.
60+
- If your commit is rejected, edit your message and try again.
61+
- For complex changes, you can add a longer body after the subject, separated by a blank line.
62+
63+
Example:
64+
```
65+
feat(core): support new user roles
66+
67+
This adds support for multiple user role types in the core module. Also refactors the existing permission system to be more scalable.
68+
```
69+
70+
---
71+
72+
# ✅ Quick Checklist Before Committing
73+
74+
- [ ] Is my commit message following the format?
75+
- [ ] Is the type correct (`feat`, `fix`, `chore`, etc.)?
76+
- [ ] Did I specify the correct scope (`core`, `openSCD`, `distribution`, etc...) if applicable?
77+
- [ ] Is the message short, clear, and imperative?
78+

0 commit comments

Comments
 (0)