Skip to content

Commit a5a380d

Browse files
committed
chore: Setup commit-lint config initially
0 parents  commit a5a380d

8 files changed

+3742
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 4
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 120
11+
trim_trailing_whitespace = true

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Node artifact files
2+
node_modules/
3+
4+
# JetBrains IDE
5+
.idea/
6+
7+
# Unit test reports
8+
coverage/
9+
test-reports/
10+
11+
# Generated by MacOS
12+
.DS_Store
13+
14+
# Generated by Windows
15+
Thumbs.db
16+
17+
# Builds
18+
dist/

.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 --no -- commitlint --edit

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# HDNET commitlint-config
2+
3+
This packages defines the strict implementation of the HDNET Commit Message Guidelines
4+
from the HDNET Standard Recommendations
5+
([HSR-3](https://wiki.hdnet.de/display/OPS/HSR-3%3A+Git+Commit-Messages)) as npm package
6+
using [commitlint](https://commitlint.js.org/)
7+
through a [shareable config](https://commitlint.js.org/#/concepts-shareable-config).
8+
9+
## Getting started
10+
11+
1. Make sure you setup node >= 14
12+
13+
2. Install dependencies
14+
```bash
15+
$ npm i -D @commitlint/cli @hdnet/commitlint-config
16+
```
17+
18+
3. Create commitlint config (i.e. `commitlint.config.js`) and extend from @hdnet/commitlint-config:
19+
```javascript
20+
module.exports = {
21+
extends: '@hdnet',
22+
23+
parserPreset: {
24+
parserOpts: {
25+
// replace "PROJECT-" with your issue prefix
26+
issuePrefixes: ['PROJECT-'],
27+
},
28+
},
29+
}
30+
```

commitlint.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { rules } = require('./index.js')
2+
3+
module.exports = {
4+
extends: '@commitlint/config-conventional',
5+
6+
parserPreset: {
7+
parserOpts: {
8+
issuePrefixes: ['#'],
9+
},
10+
},
11+
12+
rules,
13+
}

index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
/**
3+
* The base are the conventional commit definitions
4+
* @see https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/config-conventional/index.js
5+
*/
6+
extends: ['@commitlint/config-conventional'],
7+
8+
/**
9+
* Main documentation of HDNET's HSR-3 (Git Commit Messages)
10+
*/
11+
helpUrl: 'https://wiki.hdnet.de/display/OPS/HSR-3%3A+Git+Commit-Messages',
12+
13+
/**
14+
* Adapting rules for HSR-3
15+
* @see https://commitlint.js.org/#/reference-rules
16+
*/
17+
rules: {
18+
// Warn when missing project key is missing, but do not enforce (there may be cases without existing key).
19+
'references-empty': [1, 'never'],
20+
21+
// Scopes with multiple words should be separated consistently
22+
'scope-case': [2, 'always', 'kebab-case'],
23+
24+
// Subjects are sentences and begin uppercase
25+
'subject-case': [2, 'always', ['sentence-case']],
26+
27+
// Need of more types like: "dx"
28+
'type-enum': [
29+
2,
30+
'always',
31+
['build', 'chore', 'ci', 'docs', 'dx', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'],
32+
],
33+
},
34+
}

0 commit comments

Comments
 (0)