Skip to content

Conversation

@poetryofcode
Copy link

Summary

  • Update isComponentName regex from /^[A-Z]/ to /^_?[A-Z]/ to
    recognize underscore-prefixed components like _MyComponent as valid
    React components
  • Add test case for underscore-prefixed component

Test plan

  • Added test for _PrivateComponent using hooks
  • All 1432 existing tests pass

…names

Update the `isComponentName` regex to recognize components with an
underscore prefix followed by an uppercase letter (e.g., `_MyComponent`)
as valid React components. This supports the common convention of
marking components as internal/private while still allowing hooks.

Fixes facebook#31722

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@meta-cla meta-cla bot added the CLA Signed label Jan 27, 2026
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.

1 participant