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

Fix renameTo false positive for JSX tags #631

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

henryqdineen
Copy link
Contributor

This fixes an edge case that we ran into where JSX tags are inadvertently renamed when they are "built-in" components like <div> or <span>. We should only consider capitalized tags as variable references (see React docs). For this PR I used the the same regex as the JSX Babel transform for consistency.

I understand that this logic is React-specific and there could be JSX usage that does not follow these conventions. Ideally this could be configurable.

Copy link

vercel bot commented Sep 20, 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 Sep 20, 2024 4:39pm

@Daniel15
Copy link
Member

Daniel15 commented Oct 3, 2024

Good catch! Thanks.

@Daniel15 Daniel15 merged commit e7a9a72 into facebook:main Oct 3, 2024
6 of 7 checks passed
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