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

Falsly reports 'display-name' rule with antd/Table because of 'render' #2313

Closed
mikeaustin opened this issue Jun 20, 2019 · 4 comments
Closed

Comments

@mikeaustin
Copy link

Using https://ant.design/components/table (npm 'antd'), eslint-plugin-react complains about "Component definition is missing display name", assuming it thinks "render" is special.

Example code:

{
  ...,
  render: (text, record) => <img src={`logo.png`} />
}

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md

@ljharb
Copy link
Member

ljharb commented Jun 20, 2019

in this case, the function is indeed detected as an SFC, so it wants you to use function Something() { … }.

@mikeaustin
Copy link
Author

The function is not a component, and the render: is not from createReactClass. I'll just disable it.

@ljharb
Copy link
Member

ljharb commented Jun 22, 2019

it’s a function that returns jsx and takes 0-2 arguments - it’s an SFC.

@alanhe421
Copy link

What is the best way to deal with this situation?

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

3 participants