Disable unicorn/no-break-in-nested-loop (#279)#298
Merged
Conversation
Final ratchet candidate from #279. Not a clean ratchet: the rule treats a `switch` inside a loop as a "nested loop", so ~9 of the 27 sites are idiomatic switch-case `break`s (required syntax, not loop control) it would force into pointless function extractions, plus a batch of test/mock sites. The rule can't be narrowed to exclude `switch` or those sites, so it's turned off rather than left as a noisy warning. The genuinely improvable production sites were cleaned up directly: - subtree-watcher.ts: extract dispatchAddedNode() (guard continues -> returns) - rule-count.ts: extract traceUnionMatches() helper - schema-trust-sanitize.ts: extract nearestItemscope() ancestor walk - encoded-payload-redact.ts: break-on-first-decode loop -> .some() - disguised-ad-flag.ts: break-on-first-match loop -> .some() - build.ts: extract findEnvValueInContent() for the dotenv line parser - selector-token-index.ts: guard continue -> optional chaining - countdown-timer-redact.ts: guard continue -> inverted condition Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final ratchet candidate from #279.
Decision: turn off, not ratchet
unicorn/no-break-in-nested-loopflags anybreak/continuein a loop nested within another loop, wanting the inner block extracted into a function. It's not a clean ratchet:switchinside a loop as a "nested loop", so ~9 of the 27 sites are idiomatic switch-casebreaks — required syntax, not loop control (load-default-overrides.ts,css-hide-stylesheet.property.test.ts). Enabling would force pointless switch-into-function extractions.switchor narrow scope, and the remaining sites are test/mock code where extraction is awkward.Leaving it on would be all churn for no further upside, so it's set to
off(consistent with the other borderline rules in #279) with a comment explaining why.Production sites cleaned up directly
The genuinely improvable production sites were refactored rather than left behind:
subtree-watcher.tsdispatchAddedNode()(3 guardcontinues → earlyreturns)rule-count.tstraceUnionMatches()helper (2 nestedcontinues)schema-trust-sanitize.tsnearestItemscope()ancestor-walk helperencoded-payload-redact.tsbreak-on-first-decode loop →.some()disguised-ad-flag.tsbreak-on-first-match loop →.some()build.tsfindEnvValueInContent()for the dotenv line parserselector-token-index.tscontinue→ optional chaining?.countdown-timer-redact.tscontinue→ inverted conditionThis was the last open candidate in #279.
Checks
bun run check(biome + eslint + stylelint) ✅npm run typecheck(both tsconfigs) ✅🤖 Generated with Claude Code