Skip to content

fix(ci): repair main — postinstall ESM/CJS + lint sweep on landed PRs#108

Merged
JonasJesus42 merged 1 commit into
mainfrom
fix/ci-lint-and-postinstall-esm
Jun 17, 2026
Merged

fix(ci): repair main — postinstall ESM/CJS + lint sweep on landed PRs#108
JonasJesus42 merged 1 commit into
mainfrom
fix/ci-lint-and-postinstall-esm

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

CI was failing on every main commit since 0.11.0 because PRs merged via --admin accumulated three issues: (1) postinstall.js used require() in an ESM package, (2) plp-pagination.ts had noAssignInExpressions violations, (3) discover-selectors / recover-step had noDelete violations from 0.11.4 that the biome auto-fix broke when it replaced delete with attrs.class = undefined (TS rejects, since cheerio attribs is Record<string, string>).

Fixes: renamed postinstall to .cjs, rewrote loops to for (;;) + early-break, restructured class purge to only delete when empty.

Verified: bun run lint clean, bunx tsc --noEmit clean, 701 tests pass. Bumps 0.11.8.


Summary by cubic

Fixes broken CI on main by converting the postinstall script 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.

  • Bug Fixes
    • Renamed scripts/postinstall.js to scripts/postinstall.cjs and updated package.json files and postinstall so installs work with "type": "module".
    • Replaced regex while ((m = re.exec(...))) loops with for (;;) + early break in src/checks/plp-pagination.ts; fixed a summary string.
    • Safely remove empty class attributes in src/llm/discover-selectors.ts and src/llm/recover-step.ts: assign joined value when present; otherwise delete with a scoped biome-ignore due to cheerio types.
    • Minor generic typing tweak in src/report/render.ts.

Written for commit 5caf528. Summary will update on new commits.

Review in cubic

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.
@JonasJesus42 JonasJesus42 merged commit 91a9097 into main Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant