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

react/function-component-definition false positives on uncapitalized functions #3495

Open
Janpot opened this issue Nov 21, 2022 · 1 comment

Comments

@Janpot
Copy link

Janpot commented Nov 21, 2022

v7.31.10 => v7.31.11: upgrade results in a several false positives where uncapitalized functions that have a property assigned of either propTypes or defaultProps are detected as React components. (https://app.circleci.com/pipelines/github/mui/material-ui/85664/workflows/ddd6c2d7-00bc-4faf-bd09-f870eb96be44/jobs/452797)
This is new behavior. Not sure if intended?

example:

// Function component is not a function declaration
const fn = () => 'foo'
fn.propTypes = {}
@ljharb
Copy link
Member

ljharb commented Nov 22, 2022

Other than the identifier not being capitalized, that’s a react component, and the propTypes makes it a certainty. Why would anything that’s not a React component have propTypes??

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

No branches or pull requests

2 participants