fix(ci): repair main — postinstall ESM/CJS + lint sweep on landed PRs#108
Merged
Conversation
CI was broken on every main commit since 0.11.0 because PRs were merged with --admin (bypassing CI) and accumulated three classes of issues: 1. **postinstall.js used `require()` in an ESM package.** `package.json` has `"type": "module"`, so the postinstall throws `ReferenceError: require is not defined` on every `bun install` (including the CI install step). Renamed to `postinstall.cjs` and updated `package.json` `files` + `postinstall` script accordingly. 2. **plp-pagination.ts: noAssignInExpressions.** Three `while ((m = re.exec(html)))` loops rewritten to `for (;;)` + early-break. `useTemplate` fixed on the no-issues summary line. 3. **discover-selectors.ts / recover-step.ts: noDelete.** Was already present in 0.11.4. The biome auto-fix replaced `delete attrs.class` with `attrs.class = undefined`, but cheerio's `attribs` type is `Record<string, string>` so TS rejected it. Restructured to assign the joined string when non-empty and `delete` only when empty. The `delete attrs[name]` for style uses computed access which biome's `noDelete` doesn't flag. 4. **postinstall.cjs:** internal cleanup — optional chain for `err?.message`, template literal for the multi-line message. Verified locally: `bun run lint` clean, `bunx tsc --noEmit` clean, 701 tests pass. Bumps 0.11.8.
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.
CI was failing on every main commit since 0.11.0 because PRs merged via
--adminaccumulated three issues: (1)postinstall.jsusedrequire()in an ESM package, (2)plp-pagination.tshadnoAssignInExpressionsviolations, (3)discover-selectors/recover-stephadnoDeleteviolations from 0.11.4 that the biome auto-fix broke when it replaceddeletewithattrs.class = undefined(TS rejects, since cheerio attribs isRecord<string, string>).Fixes: renamed postinstall to
.cjs, rewrote loops tofor (;;)+ early-break, restructured class purge to onlydeletewhen empty.Verified:
bun run lintclean,bunx tsc --noEmitclean, 701 tests pass. Bumps 0.11.8.Summary by cubic
Fixes broken CI on main by converting the
postinstallscript to CJS and cleaning lint/type errors that slipped through admin merges. Installs now work under ESM; repo is lint- and type-clean again; bumps to 0.11.8.scripts/postinstall.jstoscripts/postinstall.cjsand updatedpackage.jsonfilesandpostinstallso installs work with"type": "module".while ((m = re.exec(...)))loops withfor (;;)+ early break insrc/checks/plp-pagination.ts; fixed a summary string.classattributes insrc/llm/discover-selectors.tsandsrc/llm/recover-step.ts: assign joined value when present; otherwisedeletewith a scopedbiome-ignoredue tocheeriotypes.src/report/render.ts.Written for commit 5caf528. Summary will update on new commits.