fix(migrate): ts-ignore → ts-expect-error + HTMX detection#52
Merged
Conversation
There was a problem hiding this comment.
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/); |
There was a problem hiding this comment.
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); |
|
🎉 This PR is included in version 0.36.4 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Two fixes for the migration script:
Summary by cubic
Auto-replaces
@ts-ignorewith@ts-expect-errorin the migration, and detects HTMXhx-*attributes that need manual React migration. Warnings are shown during transform and verify, and added to the migration report.@ts-ignorewith@ts-expect-errorin transforms (TS 5+).hx-*usage (incl.hx-on:click={useScript}), addmanualReviewItems, and warn in verify.Written for commit 79fcec9. Summary will update on new commits.