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

jsx-sort-default-props: unreachable path? #1817

Closed
hornta opened this issue Jun 8, 2018 · 2 comments
Closed

jsx-sort-default-props: unreachable path? #1817

hornta opened this issue Jun 8, 2018 · 2 comments

Comments

@hornta
Copy link

hornta commented Jun 8, 2018

Can someone explain for me why it is neccessary to check for CallExpressions in here:
https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/rules/jsx-sort-default-props.js#L133

I want to help and contribute to this project having full coverage.

@ljharb
Copy link
Member

ljharb commented Jun 8, 2018

cc @b0gok

@b0gok
Copy link
Contributor

b0gok commented Jun 11, 2018

@hornta I think it's an artifact from here (where it's necessary of course):
https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/rules/sort-prop-types.js#L156

In case of regular props it was added for this case for example:

class First extends React.Component {
  render() {
    return <div />;
  }
}

First.propTypes = forbidExtraProps({
    a: PropTypes.any,
    z: PropTypes.string,
    onFoo: PropTypes.func,
    onBar: PropTypes.func
});

When there is a callback around props definition. I'm not sure if this is necessary in case of default props.

👍 for attentiveness.

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

No branches or pull requests

3 participants