Fix check for type imports in transform-react-native-svg#907
Merged
gregberge merged 1 commit intogregberge:mainfrom Sep 28, 2023
Merged
Conversation
Signed-off-by: Yash Srivastav <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## main #907 +/- ##
==========================================
+ Coverage 92.89% 93.31% +0.42%
==========================================
Files 32 32
Lines 760 763 +3
Branches 255 258 +3
==========================================
+ Hits 706 712 +6
+ Misses 53 50 -3
Partials 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Summary
I was trying to use the babel-plugin-transform-react-native-svg separately in babel without svgr and hit an issue where it wouldn't update the import declaration.
I managed to pin it down to the new check added in #894. As per the babel spec for imports,
importKindwill benull | 'type' | 'typeof' | 'value'. When using babel to parse an existing import, its being parsed as'value'...I think its
nullwhen working with svgr because when we add the import declaration to the AST, we don't specify the import kind parameter when callinggetOrCreateImport.Test plan
Add a new test to
index.test.tsforbabel-plugin-transform-react-native-svg:Before my changes:

After my changes:
