33 lines
881 B
JavaScript
33 lines
881 B
JavaScript
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];
|
|
},
|
|
}
|
|
},
|
|
],
|
|
};
|