Skip to content

Commit ec35950

Browse files
authored
Merge pull request #2 from VisActor/chore_pre_commit
chore: add commitlint and pre-commit
2 parents 0edb44f + 3a0c443 commit ec35950

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,7 @@ common/autoinstallers/*/.npmrc
9393
# packages/vtable-docs/public/css
9494
packages/vtable-docs/public/zh/documents
9595
packages/vtable-docs/public/en/documents
96-
packages/vtable-docs/public/*.html
96+
packages/vtable-docs/public/*.html
97+
98+
#git-hook
99+
common/scripts/pre-commit
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
module.exports = {
2-
extends: ["@commitlint/config-conventional"],
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'not-allowed-chars': [2, 'always']
5+
},
6+
plugins: [
7+
{
8+
rules: {
9+
'not-allowed-chars': params => {
10+
const { raw } = params;
11+
const reg =
12+
/^[a-zA-Z0-9\s`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~@#%&*\-+={}|']+$/im;
13+
14+
return [
15+
reg.exec(raw),
16+
'Your commit message should only contain english characters, numbers, empty space, and special characters.'
17+
];
18+
}
19+
}
20+
}
21+
]
322
};

common/git-hooks/pre-commit

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/sh
22

3-
node common/scripts/install-run-rush.js lint-staged || exit $? #++
3+
node common/scripts/install-run-rush.js lint-staged || exit $? #++
4+
5+
if [ -f "common/scripts/pre-commit" ]; then
6+
common/scripts/pre-commit
7+
fi

0 commit comments

Comments
 (0)