config: add type linting to commitlint

This commit is contained in:
Abdullah Atta
2022-08-29 13:48:00 +05:00
parent 5020f189b3
commit fe793fc7ad

View File

@@ -6,12 +6,32 @@ const { readFileSync } = require("fs");
const authorEmail = execSync(`git show -s --format='%ae' HEAD`)
.toString("utf-8")
.trim();
const authors = readFileSync("AUTHORS", "utf-8");
const isAuthor = authors.includes(`<${authorEmail}>`);
const SCOPES = [
// apps
"mobile",
"web",
// packages
"crypto",
"crypto-worker",
"editor",
"logger",
"streamable-fs",
// repo maintenance
"config", // changing configuration of already installed tools in the repo
"ci", // changes related to CI
"setup", // setting up someting new in the repo (e.g. eslint, commitlint)
"docs" // changes related to documentation (README etc.)
];
module.exports = {
rules: {
"signed-off-by": [isAuthor ? 0 : 2, "always", `Signed-off-by:`]
"signed-off-by": [isAuthor ? 0 : 2, "always", `Signed-off-by:`],
"type-enum": [2, "always", SCOPES],
"type-empty": [2, "never"]
}
};