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

Should there possibly be a clearer error text for react/function-component-definition? #2554

Closed
gpkc opened this issue Feb 26, 2022 · 2 comments

Comments

@gpkc
Copy link

gpkc commented Feb 26, 2022

For me, the current error description ("Function component is not a function declaration") is ambiguous when using arrow functions. I've read #2505 and understand the reasoning but it is almost a matter of semantics whether an arrow function assigned to a const variable is a "declaration" or not, specially nowadays with ES6 being extremely widespread and people using both forms interchangeably. So it took me a while debugging this after upgrading some packages thinking it was something else. Maybe a note (no arrow functions allowed) or something like that would do it.

@ljharb
Copy link
Collaborator

ljharb commented Feb 26, 2022

sure, improving the error message here would be a fine PR. Perhaps "non-arrow function declaration"?

@ljharb
Copy link
Collaborator

ljharb commented Feb 26, 2022

That said, I'm going to close this, since it belongs filed on eslint-plugin-react, not here :-)

@ljharb ljharb closed this as completed Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants