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

Component syntax & unreachable code #9149

Open
neutraali opened this issue May 19, 2024 · 1 comment
Open

Component syntax & unreachable code #9149

neutraali opened this issue May 19, 2024 · 1 comment
Labels

Comments

@neutraali
Copy link

neutraali commented May 19, 2024

Package versions

"eslint": "8.56.0"
"eslint-plugin-ft-flow": "3.0.9"
"eslint-config-recommended": "4.1.0",
"flow-bin": "0.236.0"
"hermes-eslint": "0.21.1"

.eslintrc

{
"parser": "hermes-eslint",
"plugins": [
	"ft-flow"
],
"extends": [
	"eslint:recommended",
	"plugin:ft-flow/recommended",
]
}

Code

component C() {
	return <div />;
}

export default C;

Expected behavior

No errors!

Actual behavior

unreachable


I'm scratching my head with this one. I reduced my .eslintrc config to the bare minimum of what is expected but can't seem to make it work. What confuses me is that it works fine @ Try Flow, which makes it that much more confusing as to figuring out what I'm doing wrong.

If I make the component into a plain functional component, it works as expected. Am I missing some details when it comes to component syntax?

@SamChou19815
Copy link
Contributor

SamChou19815 commented May 19, 2024

For now, I would recommend turning off no-unreachable, since Flow already detects and errors on unreachable code. I will look into fixing it in the hermes-eslint.

(I also edited the issue to get a smaller repro)

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

No branches or pull requests

2 participants