Skip to content

Commit

Permalink
chore(constraints): break loop early; simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 9, 2024
1 parent 4502883 commit ae521de
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -761,23 +761,24 @@ function expectConsistentDependenciesAndDevDependencies(Yarn) {
dependencyIdent,
dependenciesByRange,
] of nonPeerDependenciesByIdent.entries()) {
if (dependenciesByRange.size <= 1) {
continue;
}
const dependenciesToConsider =
getInconsistentDependenciesAndDevDependencies(
dependencyIdent,
dependenciesByRange,
);
const dependencyRanges = [...dependenciesToConsider.keys()].sort();
if (dependenciesByRange.size > 1) {
for (const dependencies of dependenciesToConsider.values()) {
for (const dependency of dependencies) {
dependency.error(
`Expected version range for ${dependencyIdent} (in ${
dependency.type
}) to be consistent across monorepo. Pick one: ${inspect(
dependencyRanges,
)}`,
);
}
for (const dependencies of dependenciesToConsider.values()) {
for (const dependency of dependencies) {
dependency.error(
`Expected version range for ${dependencyIdent} (in ${
dependency.type
}) to be consistent across monorepo. Pick one: ${inspect(
dependencyRanges,
)}`,
);
}
}
}
Expand Down

0 comments on commit ae521de

Please sign in to comment.