fix: avoid false positives in import protection#6732
Conversation
📝 WalkthroughWalkthroughRemoved per-environment Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 229d8d0
☁️ Nx Cloud last updated this comment at |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
b1849a1 to
229d8d0
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
e2e/react-start/import-protection/tests/import-protection.spec.ts (1)
491-492: Correct fix:previs always defined in this loop context.Since the loop starts at
i = 1and thefindpredicate requirestrace.length >= 3,prev = v!.trace[i - 1]is guaranteed to reference a valid element. Removing the unnecessary optional chaining onprevis appropriate.Consider applying the same fix to line 138 for consistency, where the identical loop structure also guarantees
previs defined.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/react-start/import-protection/tests/import-protection.spec.ts` around lines 491 - 492, The variable prev is provably always defined in the loop (loop starts at i = 1 and the surrounding find ensures trace.length >= 3), so remove the unnecessary optional chaining on prev (change prev.specifier?.includes('?tsr-split=') to prev.specifier.includes('?tsr-split=')). Also make the identical change at the other occurrence in the file (the similar loop around the earlier occurrence near the other trace handling, referenced in the review) so both spots consistently drop the optional chaining.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@e2e/react-start/import-protection/tests/import-protection.spec.ts`:
- Around line 491-492: The variable prev is provably always defined in the loop
(loop starts at i = 1 and the surrounding find ensures trace.length >= 3), so
remove the unnecessary optional chaining on prev (change
prev.specifier?.includes('?tsr-split=') to
prev.specifier.includes('?tsr-split=')). Also make the identical change at the
other occurrence in the file (the similar loop around the earlier occurrence
near the other trace handling, referenced in the review) so both spots
consistently drop the optional chaining.
Summary by CodeRabbit