File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {
1717 buildCommit ,
1818 log ,
1919 enumRuleIsActive ,
20- ruleIsActive ,
20+ emptyRuleIsActive ,
2121 getEnumList ,
2222 getValueByCallBack
2323} from "./until" ;
@@ -55,7 +55,7 @@ export const generateOptions = (clConfig: UserConfig): CommitizenGitOptions => {
5555 scopes : pkgConfig . scopes ?? clPromptConfig . scopes ?? getEnumList ( clConfig ?. rules ?. [ "scope-enum" ] as any ) ,
5656 scopeOverrides : pkgConfig . scopeOverrides ?? clPromptConfig . scopeOverrides ?? defaultConfig . scopeOverrides ,
5757 allowCustomScopes : pkgConfig . allowCustomScopes ?? clPromptConfig . allowCustomScopes ?? ! enumRuleIsActive ( clConfig ?. rules ?. [ "scope-enum" ] as any ) ,
58- allowEmptyScopes : pkgConfig . allowEmptyScopes ?? clPromptConfig . allowEmptyScopes ?? ! ruleIsActive ( clConfig ?. rules ?. [ "scope-empty" ] as any ) ,
58+ allowEmptyScopes : pkgConfig . allowEmptyScopes ?? clPromptConfig . allowEmptyScopes ?? ! emptyRuleIsActive ( clConfig ?. rules ?. [ "scope-empty" ] as any ) ,
5959 customScopesAlign : pkgConfig . customScopesAlign ?? clPromptConfig . customScopesAlign ?? defaultConfig . customScopesAlign ,
6060 customScopesAlias : pkgConfig . customScopesAlias ?? clPromptConfig . customScopesAlias ?? defaultConfig . customScopesAlias ,
6161 emptyScopesAlias : pkgConfig . emptyScopesAlias ?? clPromptConfig . emptyScopesAlias ?? defaultConfig . emptyScopesAlias ,
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export function ruleIsActive<T extends Rule>(
3636}
3737
3838/**
39- * @description : rule is can ignore
39+ * @description : rule is effect.
4040 */
4141export function ruleIsNotApplicable (
4242 rule : Rule
@@ -50,7 +50,7 @@ export function ruleIsNotApplicable(
5050}
5151
5252/**
53- * @description : rule is effect
53+ * @description : rule is can ignore
5454 */
5555export function ruleIsApplicable (
5656 rule : Rule
@@ -75,6 +75,10 @@ export function getEnumList(rule: Rule | undefined): string[] {
7575 return rule && Array . isArray ( rule ) && Array . isArray ( rule [ 2 ] ) ? rule [ 2 ] : [ ] ;
7676}
7777
78+ export function emptyRuleIsActive ( rule : Rule | undefined ) : boolean {
79+ return rule && Array . isArray ( rule ) ? ruleIsActive ( rule ) && ruleIsNotApplicable ( rule ) : false ;
80+ }
81+
7882/**
7983 * @example : getMaxLength(rules['max-header-length'] => 100)
8084 */
You can’t perform that action at this time.
0 commit comments