Skip to content

fix(migrate): ts-ignore → ts-expect-error + HTMX detection#52

Merged
JonasJesus42 merged 2 commits into
mainfrom
JonasJesus42/migrate-htmx-tsignore
Mar 27, 2026
Merged

fix(migrate): ts-ignore → ts-expect-error + HTMX detection#52
JonasJesus42 merged 2 commits into
mainfrom
JonasJesus42/migrate-htmx-tsignore

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Two fixes for the migration script:

  1. @ts-ignore@ts-expect-error: Auto-converts all @ts-ignore to @ts-expect-error (TypeScript 5+ preferred)
  2. HTMX detection: Flags files with hx-* attributes in verify phase + MIGRATION_REPORT for manual React migration

Summary by cubic

Auto-replaces @ts-ignore with @ts-expect-error in the migration, and detects HTMX hx-* attributes that need manual React migration. Warnings are shown during transform and verify, and added to the migration report.

  • Bug Fixes
    • Replace all @ts-ignore with @ts-expect-error in transforms (TS 5+).
    • Detect hx-* usage (incl. hx-on:click={useScript}), add manualReviewItems, and warn in verify.

Written for commit 79fcec9. Summary will update on new commits.

@JonasJesus42
JonasJesus42 merged commit a88b5fd into main Mar 27, 2026
1 check passed

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/migrate/phase-verify.ts">

<violation number="1" location="scripts/migrate/phase-verify.ts:334">
P2: The new HTMX verifier claims to block all `hx-*` attributes, but the regex only checks a small subset and will miss other HTMX attributes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

fn: (ctx) => {
const srcDir = path.join(ctx.sourceDir, "src");
if (!fs.existsSync(srcDir)) return true;
const bad = findFilesWithPattern(srcDir, /\bhx-(?:get|post|put|delete|patch|trigger|target|swap|on|indicator|sync|select)\b/);

@cubic-dev-ai cubic-dev-ai Bot Mar 27, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new HTMX verifier claims to block all hx-* attributes, but the regex only checks a small subset and will miss other HTMX attributes.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/migrate/phase-verify.ts, line 334:

<comment>The new HTMX verifier claims to block all `hx-*` attributes, but the regex only checks a small subset and will miss other HTMX attributes.</comment>

<file context>
@@ -325,6 +325,20 @@ const checks: Check[] = [
+    fn: (ctx) => {
+      const srcDir = path.join(ctx.sourceDir, "src");
+      if (!fs.existsSync(srcDir)) return true;
+      const bad = findFilesWithPattern(srcDir, /\bhx-(?:get|post|put|delete|patch|trigger|target|swap|on|indicator|sync|select)\b/);
+      if (bad.length > 0) {
+        console.log(`    HTMX attributes found (needs manual React migration): ${bad.join(", ")}`);
</file context>
Suggested change
const bad = findFilesWithPattern(srcDir, /\bhx-(?:get|post|put|delete|patch|trigger|target|swap|on|indicator|sync|select)\b/);
const bad = findFilesWithPattern(srcDir, /\bhx-[a-z0-9-]+\b/i);
Fix with Cubic

@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.36.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant