Files
notesnook/.commitlintrc.js

42 lines
892 B
JavaScript
Raw Normal View History

2022-08-29 13:17:45 +05:00
/* eslint-disable @typescript-eslint/no-var-requires */
const { execSync } = require("child_process");
const { readFileSync } = require("fs");
const authorEmail = execSync(`git config --global --get user.email`)
2022-08-29 13:17:45 +05:00
.toString("utf-8")
.trim();
const authors = readFileSync("AUTHORS", "utf-8");
const isAuthor = authors.includes(`<${authorEmail}>`);
2022-08-29 13:48:00 +05:00
const SCOPES = [
2022-08-29 14:09:25 +05:00
// for full list of scopes + details see: https://github.com/streetwriters/notesnook-private/blob/master/CONTRIBUTING.md#commit-guidelines
2022-08-29 13:48:00 +05:00
"mobile",
"web",
2022-08-29 14:09:25 +05:00
"desktop",
2022-08-29 13:48:00 +05:00
"crypto",
"editor",
"logger",
"theme",
"core",
2023-05-24 15:49:05 +05:00
"fs",
"clipper",
2022-08-29 14:09:25 +05:00
"config",
"ci",
"setup",
"docs",
2022-08-31 20:06:35 +05:00
"refactor",
2022-09-26 15:29:34 +05:00
"misc",
2023-06-10 12:30:31 +05:00
"common",
2022-09-26 15:29:34 +05:00
"global"
2022-08-29 13:48:00 +05:00
];
2022-08-29 13:17:45 +05:00
module.exports = {
rules: {
2022-08-29 13:48:00 +05:00
"signed-off-by": [isAuthor ? 0 : 2, "always", `Signed-off-by:`],
"type-enum": [2, "always", SCOPES],
"type-empty": [2, "never"]
2022-08-29 13:17:45 +05:00
}
};