Merge pull request #2 from VisActor/chore_pre_commit

chore: add commitlint and pre-commit
This commit is contained in:
方帅 2023-06-07 15:35:19 +08:00 committed by GitHub
commit 9af9310599
3 changed files with 29 additions and 3 deletions

5
.gitignore vendored
View File

@ -93,4 +93,7 @@ common/autoinstallers/*/.npmrc
# packages/vtable-docs/public/css
packages/vtable-docs/public/zh/documents
packages/vtable-docs/public/en/documents
packages/vtable-docs/public/*.html
packages/vtable-docs/public/*.html
#git-hook
common/scripts/pre-commit

View File

@ -1,3 +1,22 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
extends: ['@commitlint/config-conventional'],
rules: {
'not-allowed-chars': [2, 'always']
},
plugins: [
{
rules: {
'not-allowed-chars': params => {
const { raw } = params;
const reg =
/^[a-zA-Z0-9\s`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、]+$/im;
return [
reg.exec(raw),
'Your commit message should only contain english characters, numbers, empty space, and special characters.'
];
}
}
}
]
};

View File

@ -1,3 +1,7 @@
#!/bin/sh
node common/scripts/install-run-rush.js lint-staged || exit $? #++
node common/scripts/install-run-rush.js lint-staged || exit $? #++
if [ -f "common/scripts/pre-commit" ]; then
common/scripts/pre-commit
fi