Skip to content

Commit

Permalink
Bugfix: Wait for rules to be processed before trying to validate them
Browse files Browse the repository at this point in the history
  • Loading branch information
spautz committed May 19, 2021
1 parent d778487 commit f0f4047
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/packagelint/lib-src/prepare/accumulateRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function accumulateRules(
): Promise<Array<PackagelintPreparedRule>> {
const accumulator = new RuleAccumulator();

accumulator.accumulateRuleList(packagelintConfig.rules);
await accumulator.accumulateRuleList(packagelintConfig.rules);

return accumulator.getPreparedRuleList();
}
Expand All @@ -42,10 +42,13 @@ class RuleAccumulator {
accumulateRuleList(
ruleList: Array<PackagelintRuleEntry | PackagelintRulesetEntry>,
overrides?: Partial<PackagelintRuleConfig>,
): void {
ruleList.forEach((ruleInfo: PackagelintRuleEntry | PackagelintRulesetEntry) => {
this.accumulateRule(ruleInfo, overrides);
});
): Promise<void> {
const allPendingRules = ruleList.map(
(ruleInfo: PackagelintRuleEntry | PackagelintRulesetEntry) => {
return this.accumulateRule(ruleInfo, overrides);
},
);
return Promise.all(allPendingRules).then();
}

/**
Expand Down

0 comments on commit f0f4047

Please sign in to comment.