Repository navigation
Conversation
`noDuplicateFixedPackages` and `noDuplicateLinkedPackages` in packages/config/src/rules.ts push an error for every name accumulated in `duplicatedNames` inside the loop over the groups, so once a name lands in that set every later group pushes the same message again. A config with `fixed: [["pkg-a"], ["pkg-a"], ["pkg-b"]]` prints the "pkg-a is defined in multiple groups of fixed packages" error twice, and one more time for each additional group. Two groups happened to be the only shape covered by the tests, and that shape hides the bug because nothing follows the duplicate. The push now happens after the loop, so each duplicated package produces exactly one error no matter how many groups follow it.
✅ Deploy Preview for changesets ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 1aa8890 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2282 +/- ##
=======================================
Coverage 84.57% 84.57%
=======================================
Files 80 80
Lines 3177 3177
Branches 896 896
=======================================
Hits 2687 2687
Misses 433 433
Partials 57 57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
How is it fully automated? |
|
Not that it's a bad thing, I'm just wondering why you say that. I don't mind either way, it's your repo and I respect it oc |
|
Your PR description is overly verbose, we do not need to know the number of tests passed or what tests you've added. We can see on the GitHub UI and diff. You've also opened 88 PRs in the last 2 days. These kinds of contribution patterns just don't give confidence to any OSS maintainers. |
|
I included that info so it can viewed at a glance. It's your preference, and it's now noted. As for the large amount of PRs recently - I've only made one PR in this repository. What I do in other repositories, many of which are my own, is not your concern. |
A project with three or more
fixedorlinkedgroups gets the "defined in multiple groups" config error printed once for every group that follows the duplicate. Withfixed: [["pkg-a"], ["pkg-a"], ["pkg-b"]]thepkg-amessage is printed twice, and adding a fourth group prints it three times.The cause is in
packages/config/src/rules.ts.noDuplicateFixedPackages(line 39) andnoDuplicateLinkedPackages(line 79) collect duplicates into aduplicatedNamesset, but theerrors.push(...Array.from(duplicatedNames, ...))call sits inside the loop over the groups, at line 52 and line 92. Every iteration re-emits a message for every name already in the set, so a name first seen twice while processing group 2 of 4 gets pushed by groups 2, 3 and 4. The two existing cases inpackages/config/src/parse.test.tsuse two groups,fixed: [["pkg-a"], ["pkg-a"]]andlinked: [["pkg-a"], ["pkg-a"]], where the duplicate is in the last group and no later iteration exists to repeat it, and the table harness compares expected substrings positionally without checking how many errors came back, so neither case could catch this.The fix moves both pushes out of the loop. Each duplicated package now produces exactly one error regardless of how many groups follow it. The set of names collected, the message text, and the early return when the group list is empty are all unchanged.
Two regression tests are added to the
rulesblock ofpackages/config/src/parse.test.ts, one forfixedand one forlinked, each asserting exactly one error for[["pkg-a"], ["pkg-a"], ["pkg-b"]]. Against unmodifiedrules.tsboth fail withAssertionError: expected [ …(2) ] to have a length of 1 but got 2. With the fix,pnpm vitest run packages/configreportsTest Files 2 passed (2)andTests 65 passed (65).Verified on macOS with Node 22.23.2 and pnpm 11.13.1.
pnpm test run --maxWorkers=3reportsTest Files 41 passed (41)andTests 916 passed | 2 skipped | 2 todo (920)in 130.94s, with no failures.pnpm types:check,pnpm lintandpnpm formateach exit 0, withoxfmt --checkreporting "All matched files use the correct format" across 298 files.Changeset included, patch bump for
@changesets/config.