Repository navigation
Conversation
The rule only matched bare it/test/describe/suite and it.effect/it.live calls, so it.each(cases)(...), describe.each(cases)(...) and it.effect.each(cases)(...) registered once per loop iteration passed lint. The rule now also reports a call whose callee is <test>.each(cases), where <test> is one of the registration names it already recognizes, and tells the author to fold the loop into the one .each list. skip/only/skipIf chains stay allowed, since they have no .each. Two existing tests registered .each suites in a loop. Their loop values now live in the case list, with identical test names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The lint rule now catches .each test suites declared inside for loops while retaining its existing scope and exemptions. The change affects developer diagnostics, not product defaults or runtime behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note 🤖 Opus 5.5 replying on behalf of Victor. Closing this to bring my open PRs down under the new limit. The branch stays on my fork if it is useful. |
Problem
t3code/no-test-in-loop(#14921) reportsit(...),it.effect(...)anddescribe(...)inside aforloop, but not a parameterized suite declared in a loop:it.each(cases)(...),describe.each(cases)(...)orit.effect.each(cases)(...). Two files on main register one.eachsuite per loop iteration and pass lint:BitbucketPullRequestProvider.test.ts:72andelicitationForm.test.ts:7.Change
<T>.each(cases), where<T>is a name it already accepts (describe,it,suite,test, or<T>.effect/<T>.live). It reusestestCallNameinstead of walking any member chain. A loop variable namedtest(as inprovider-pi/src/server/adapter.test.ts) is not flagged. It reports once, on the outer call:Do not call it.each(…)(…) inside a for loop. Fold the loop into one it.each(cases) list instead.skip,only,todo,skipIfandrunIfchains are unchanged. On@effect/vitest'sit.effectandit.livethey return a test with no.each, andno-test-timeout-or-unreasoned-skipalready coversskipandonly. A valid row records this.flatMap) and title it with$operation/$variant/$type. Test names are unchanged: verbose-reporter name lists before and after are identical (Bitbucket 19, elicitationForm 6). The test bodies are only re-indented (git diff -wshows 14 changed lines per file).it.each,describe.eachreported once,it.effect.each) and 2 valid rows (it.effect.skipIfin a loop, loop variable namedtest).Scope and approval
A focused lint fix with no runtime change. It closes a gap in a rule a maintainer added (#14921), using that rule's own remedy, and migrates the only 2 sites the fixed rule reports. There is no issue for it: the gap was found by running the rule's own harness against loop-registered
.eachforms, and the fix is small enough to review directly.Verification
Runs on main eceeab4 and on this branch 5ca66c3 merged locally with it (74b3a0dfba, not pushed; clean merge, the 4 changed files byte-identical to 5ca66c3). "Before" runs bind this branch's rule or rule test file read-only over main's copy. Output below is unedited;
lint exitis the status ofvp lint.vp lintover all 2054 tracked test files on main: 0no-test-in-loopdiagnostics. This branch's rule on main's files flags exactly the 2 sites,BitbucketPullRequestProvider.test.ts:72andelicitationForm.test.ts:7, and nothing inprovider-pi. The merged tree: 0.Not checked: full test suites on the merged tree (CI runs them).
Run output: rule tests and repo-wide lint, before and after
Before: main's rule against this branch's rule tests (3 failed, 10 passed).
After: rule tests on the merged tree (13 passed).
Before:
vp linton main with main's rule (0 diagnostics).Before:
vp linton main's files with this branch's rule (the 2 loop.eachsites).After:
vp linton the merged tree (0 diagnostics).Generated with Claude Opus 5.5 in T3 Code Nightly