chore: no emoji on commit message
This commit is contained in:
parent
86fdfa5560
commit
e39cd1ac61
2 changed files with 34 additions and 2 deletions
2
.husky/commit-msg
Normal file → Executable file
2
.husky/commit-msg
Normal file → Executable file
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
npx --no -- commitlint --config node_modules/@uwil/husky-config/commitlint.config.cjs --edit $1
|
||||
npx --no -- commitlint --config commitlint.config.cjs --edit $1
|
||||
|
|
|
|||
|
|
@ -1 +1,33 @@
|
|||
module.exports = require('@uwil/husky-config/commitlint.config.cjs');
|
||||
const baseConfig = require("@uwil/husky-config/commitlint.config.cjs");
|
||||
|
||||
module.exports = {
|
||||
...baseConfig,
|
||||
rules: {
|
||||
...baseConfig.rules,
|
||||
// * Disable Emoji rule
|
||||
"emoji-valid": [0],
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
rules: {
|
||||
...baseConfig.plugins[0].rules,
|
||||
"message-valid": (parsed) => {
|
||||
const { header } = parsed;
|
||||
|
||||
const contentMatch = header.match(/^[^:]+:\s*(.*)$/);
|
||||
const fullContent = contentMatch ? contentMatch[1].trim() : "";
|
||||
|
||||
const textOnly = fullContent.replace(/^([\p{Emoji}]|:\w+:)\s*/u, "").trim();
|
||||
|
||||
if (!textOnly || textOnly.length < 3 || textOnly.length > 255) {
|
||||
return [
|
||||
false,
|
||||
"message must be between 3 and 255 characters \x1b[90m(ex: resolve errors)\x1b[0m",
|
||||
];
|
||||
}
|
||||
return [true];
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue