feat: graceful multiple imports exit + transform and refine#1273
Merged
fabian-hiller merged 4 commits intoopen-circle:mainfrom Sep 6, 2025
Merged
feat: graceful multiple imports exit + transform and refine#1273fabian-hiller merged 4 commits intoopen-circle:mainfrom
transform and refine#1273fabian-hiller merged 4 commits intoopen-circle:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for transforming Zod's refine and transform methods to their Valibot equivalents and improves error handling for multiple import scenarios. The changes enhance the codemod to handle more Zod patterns while providing better feedback when transformation fails.
- Adds transformation support for
refine(to Valibot'scheck) andtransformmethods - Improves error handling by adding descriptive comments when imports cannot be transformed
- Includes comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| schemas-and-links.ts | Registers refine and transform method transformers |
| transform/transform.ts | Implements Zod transform to Valibot transform conversion |
| refine/refine.ts | Implements Zod refine to Valibot check conversion with message extraction |
| index.ts | Adds error comment injection for unsuccessful import transformations |
| imports.ts | Adds cause field to error return types for better error reporting |
| constants.ts | Adds refine and transform to supported Zod methods list |
| test files | Adds test fixtures for new functionality and multiple import scenarios |
codemod/zod-to-valibot/src/transform/schemas-and-links/methods/refine/refine.ts
Show resolved
Hide resolved
codemod/zod-to-valibot/src/transform/schemas-and-links/methods/refine/refine.ts
Show resolved
Hide resolved
transform and refine
commit: |
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.
Some other small codemod fixes: this fixes
transform,refineand adds a comment to explain why it's not possible to migrate the file when there's multiple zod imports (i also think we could try to be a bit smarter here and still migrate if at least one import iszfromzodbut that would lead to squiggles in the file unless we also replace all the zod types)