fix: resolve lint violations blocking xo v4 / ava v8 upgrade - #8
Merged
Conversation
The open dependabot PR bumping xo (1.2.3 -> 4.0.0) and ava (7.0.0 -> 8.0.1) fails CI because xo 4.0.0 pulls in newer eslint-plugin-unicorn rules that flag pre-existing patterns in this repo's source: - Duplicate if/else-if branches in diff() (object vs array cases shared an identical body) -> merged into one condition. - `key in object` existence checks -> replaced with Object.hasOwn(). - A whole-loop-body if in the removal pass -> converted to an early continue. - break statements inside a switch nested in patch()'s for loop -> switch extracted into a standalone applyOperation() helper. - A JSDoc @param description that just repeated the param name. None of this changes runtime behavior (all 34 existing tests still pass unmodified); it just brings the source in line with the stricter lint rules any future xo major bump will apply. This has been blocking every grouped dependency-update PR the merge daemon looks at, so it belongs on master rather than on the individual dependabot branches.
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.
Root cause
The open dependabot PR (#6) bumping
xo(1.2.3 -> 4.0.0) andava(7.0.0 -> 8.0.1) has been failing CI on all Node versions, which is why the automated merge daemon has been skipping it (and would skip any future grouped dependency-update PR touchingxo) for weeks.xo4.0.0 pulls in newereslint-plugin-unicorn/eslint-plugin-jsdocrules that flag pre-existing patterns already present inindex.js/index.d.tsonmaster. Becausepackage.jsonpinsxoto^1.2.3,master's own CI never sees these rules and stays green — but the moment any PR bumpsxopast that range, the new rules fire against unrelated, already-merged code:unicorn/no-duplicate-if-branchesx2 — the array/object branches ofdiff()had identical bodiesunicorn/no-computed-property-existence-checkx2 —key in objectchecksunicorn/prefer-continue— a whole loop body wrapped in oneifunicorn/no-break-in-nested-loopx3 —breakinside aswitchnested inpatch()'sforloopjsdoc/informative-docs— a@paramdescription that just repeated the param nameFix
Refactored the flagged spots without changing behavior:
diff()into a single condition (they already called the same recursivediff()regardless of array vs. object).key in objectwithObject.hasOwn(object, key).ifinto an earlycontinue.patch()'sswitchinto a standaloneapplyOperation()helper so itsbreakstatements are no longer nested inside the outer loop.This is a source-only fix —
package.jsonis untouched, since the actual dependency bump belongs to the dependabot PR, not this one.Verification
npm test(xo && ava && tsd) passes clean against the currently pinned versions (xo@1.2.3,ava@7.0.0) — only a pre-existing, non-blockingcomplexitywarning remains.xo@4.0.0,ava@8.0.1): all 9 previously-failing lint errors are gone, all 34avatests pass unmodified,tsdpasses.Note (separate issue, not touched here)
.github/workflows/release.ymltriggerspush: branches: [main], but this repo's default branch ismaster— so the release workflow never runs. Flagging for awareness; out of scope for this CI fix.