Skip to content

Commit a7765dc

Browse files
adopt: commit lint & prettier❤️
1 parent c79c37b commit a7765dc

File tree

7 files changed

+942
-1
lines changed

7 files changed

+942
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn commitlint ${1}

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# yarn test
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"singleQuote": true,
33
"arrowParens": "always",
4-
"printWidth": 60,
4+
"printWidth": 120,
55
"trailingComma": "all"
66
}

commitlint.config.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const emojis = [
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+
const includeEmojis = new RegExp(`[${emojis.join('')}]`, 'g');
29+
30+
const config = {
31+
extends: ['@commitlint/config-conventional'],
32+
plugins: [
33+
{
34+
rules: {
35+
'header-match-team-pattern': (parsed) => {
36+
const { subject } = parsed;
37+
if (includeEmojis.test(subject) === false) {
38+
return [false, 'subject should include one of [' + emojis.join(', ') + ']'];
39+
}
40+
return [true, ''];
41+
},
42+
},
43+
},
44+
],
45+
/*
46+
* Any rules defined here will override rules from @commitlint/config-conventional
47+
*/
48+
rules: {
49+
'scope-case': [0, 'always', 'lower-case'],
50+
'subject-case': [0, 'always', 'lower-case'],
51+
'header-match-team-pattern': [2, 'always'],
52+
'type-enum': [
53+
2,
54+
'always',
55+
['add', 'adopt', 'build', 'chore', 'docs', 'feat', 'fix', 'refactor', 'remove', 'style'],
56+
],
57+
},
58+
};
59+
60+
module.exports = config;

package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "js-assessments",
3+
"version": "1.0.0",
4+
"license": "ISC",
5+
"devDependencies": {
6+
"@commitlint/cli": "^19.2.1",
7+
"@commitlint/config-conventional": "^19.1.0",
8+
"@types/node": "^20.11.30",
9+
"husky": "^9.0.11",
10+
"prettier": "^3.2.5",
11+
"typescript": "^5.4.2"
12+
},
13+
"scripts": {
14+
"prepare": "husky",
15+
"commitlint": "commitlint --edit"
16+
}
17+
}

0 commit comments

Comments
 (0)