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

isStatelessComponent: Handle Logical and Conditional Expressions #245

Merged
merged 1 commit into from
Feb 7, 2018
Merged

isStatelessComponent: Handle Logical and Conditional Expressions #245

merged 1 commit into from
Feb 7, 2018

Conversation

danez
Copy link
Collaborator

@danez danez commented Jan 25, 2018

Besides refactoring the module it now supports components that return
LogicalExpressions or ConditionalExpressions. I also removed the "manual" scope check
and instead use the scope returned by ast-types and compare that one.
The test have been rewritten to be composed of certain parameters instead
of hardcoding all possible testcases.

function MyComponent () {
  return a ? <jsx /> : b 
  // or
  return a || <jsx />;
}

This should improve some cases reported in #232

A further improvement would be to also account for .forEach, .reduce etc.

@danez danez changed the title Handle Logical and Conditional Expressions isStatelessComponent: Handle Logical and Conditional Expressions Jan 25, 2018
Besides refactoring the module it now supports components that return
LogicalExpressions or ConditionalExpressions.
The test have been rewritten to be composed of certain parameters instead
of hardcoding all possible testcases.
@danez danez merged commit d2c096f into reactjs:master Feb 7, 2018
@danez danez deleted the improvestateless branch February 7, 2018 14:50
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant