You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(worker): remove, log invalid rules set via settings.json#commitlint.config.extend.rules
fixesjoshbolduc#793
This gracefully handles invalid configurations set via the extension's configuration. Previously, commitlint's Lint function would throw an error if our extendRules contained rules that do not satisfy commitlint's
`AnyRuleConfig<RuleConfigQuality.Qualified>`.
// remove some invalid rules from client's rules (non-thorough). The
97
+
// rules of a bad config (e.g. in settings.json) may contain non-rule
98
+
// values. This should be _loudly_ reported to the user. Although
99
+
// commitlint would report it, it won't denote the config the invalid
100
+
// rules came from. We must do it, instead.
101
+
message.extendsRules=Object.fromEntries(
102
+
Object.entries(message.extendsRules)
103
+
.filter((entry)=>!isInvalidRule(entry))
104
+
)satisfiestypeofmessage.extendsRules;
105
+
106
+
if(Object.keys(invalidRules).length>0){
107
+
// TODO: change to warn(...) after implementing multi-LogLevel logging in IPC API. See https://www.npmjs.com/package/@vscode-logging/logger
108
+
log(`One or more rules configured in user- or workspace-scoped settings.json#commitlint.config.extend.rules are invalid!\n${JSON.stringify(invalidRules,undefined,2)}`);
0 commit comments