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/jsx-handler-names] False positive when prettier formatted multiline prop is used #2785

Closed
yugandhar02 opened this issue Sep 3, 2020 · 1 comment · Fixed by #2789
Closed

Comments

@yugandhar02
Copy link

I have a component with large nested tree.
When formatted with prettier it splits event handler name in multi line form due to limited print width something like below

class Foo extends React.PureComponent<Props> { 
  handleClick() { 
  }

  render() {
    return (
      <Bar 
        id={id},
        onClick={
          this
            .handleClick
         }
      />
    );
  }
}

It gives me error about invalid handler name even though the handler name is correct

error Handler function for onClick prop key must begin with 'handle' react/jsx-handler-names

@ljharb
Copy link
Member

ljharb commented Sep 3, 2020

Although that prettier output is revolting, I agree it's a bug that the whitespace isn't taken into account.

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

Successfully merging a pull request may close this issue.

2 participants