Skip to content

Commit

Permalink
Merge pull request #2 from VisActor/chore_pre_commit
Browse files Browse the repository at this point in the history
chore: add commitlint and pre-commit
  • Loading branch information
fangsmile authored Jun 7, 2023
2 parents 0edb44f + 3a0c443 commit ec35950
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 20 additions & 1 deletion common/autoinstallers/lint/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -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.'
];
}
}
}
]
};
6 changes: 5 additions & 1 deletion common/git-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ec35950

Please sign in to comment.