-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from VisActor/chore_pre_commit
chore: add commitlint and pre-commit
- Loading branch information
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
]; | ||
} | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |