Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of custom collection functions for importDeclarations/Specifiers #617

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

danieldelcore
Copy link

Adds utility methods for import specifiers (similar to the ones provided for JSXElements).

Why?

Import manipulation is probably the most common operation you will do in a codemod, but there are quite a few edge cases to consider when doing so.

For example,

  • Insert imports / specifiers without duplication
  • Renaming import paths
  • Checking for imports (good for early exit conditions)

GLOBALS

insertImportDeclaration
insertImportSpecifiers
findImportDeclarations
findImportSpecifier
findDefaultSpecifier
hasImportSpecifier
hasDefaultImportSpecifier

FILTERS

TBD

Previous PR: #611

Copy link

vercel bot commented Jul 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jscodeshift ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2024 7:02am

@danieldelcore
Copy link
Author

Ok @Daniel15 should be good to go now 😄

@Daniel15
Copy link
Member

Daniel15 commented Aug 2, 2024

Thanks! Tests are passing - looks good.

@Daniel15 Daniel15 merged commit 9e90758 into facebook:main Aug 2, 2024
6 checks passed
@Daniel15
Copy link
Member

Daniel15 commented Aug 6, 2024

Released in v17.0.0. Thanks for your contribution!

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

Successfully merging this pull request may close these issues.

3 participants