@ruan-cat/commitlint-config
Version:
阮喵喵自用的 commitlint.config.cjs 配置。
52 lines (47 loc) • 1.44 kB
text/typescript
import { UserConfig, ScopesType } from 'cz-git';
export { ScopesType } from 'cz-git';
/**
* 用户自己额外配置的范围项 拆分出表述文本的配置项
* @description
*/
type ScopesItemWithDesc = {
/** 输入时的提示词 */
code: string;
/** 最终显示在 git commit 的文本 */
value: string;
/** 表述文本 */
desc: string;
};
/**
* ScopesType 的数组配置项
* @description
* 为了约束配置范围
*/
type ScopesTypeItem = Exclude<ScopesType[number], string>;
/**
* 用户配置项
* @description
* 可以是 ScopesTypeItem 或 ScopesItemWithDesc
*/
type UserScopesItem = ScopesTypeItem | ScopesItemWithDesc;
type GetUserConfigParams = {
/** 用户提供的范围配置 */
userScopes?: UserScopesItem[];
config?: {
/**
* 是否打印范围?
* @default true 默认打印 提示用户可以使用的提交范围有哪些
*/
isPrintScopes?: boolean;
};
};
/**
* 获取用户配置
* @description
* 可以根据用户提供的范围,补充范围配置
*
* 其范围配置数组,默认排序到最前面,其次才是自动识别到包范围。
*/
declare function getUserConfig(params?: GetUserConfigParams): UserConfig;
declare const defExportCommitlintConfig: UserConfig;
export { type ScopesItemWithDesc, type ScopesTypeItem, type UserScopesItem, defExportCommitlintConfig as default, getUserConfig };