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

False-positive in react/prop-types #698

Closed
wereHamster opened this issue Jul 22, 2016 · 1 comment
Closed

False-positive in react/prop-types #698

wereHamster opened this issue Jul 22, 2016 · 1 comment

Comments

@wereHamster
Copy link

export function SomeComponent() {
  function f({foo}) {}

  return <div className={f()} />;
}

Somehow eslint thinks that the {foo} is a component prop:

'foo' is missing in props validation

It seems that the detection what actually is a prop is not precise enough. Because this warning/error can be avoided when I don't destruct the argument of the f function and instead access properties on it with the dot-notation:

  function f(x) { x.foo ... }

Or if I destruct the argument inside the function body:

  function f(x) { const {foo} = p; }

All three definitions of the f function are semantically equivalent, but this eslint plugin treats them differently.

@wereHamster
Copy link
Author

Similar to #504

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

1 participant