Skip to content

Component syntax & unreachable code #9149

Open

Description

@neutraali

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?

Activity

  1. SamChou19815 commented on May 19, 2024

    @SamChou19815
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions