Skip to content

Extract used prop types detection code #2

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

Closed
wants to merge 2 commits into from

Conversation

alexzherdev
Copy link
Owner

There is a single spec failing here:

class Hello extends React.Component {
  render() {
    var {
      "aria-controls": ariaControls,
      propX,
      ...props } = this.props;
    return <div>Hello</div>;
  }
}
Hello.propTypes = {
  "aria-controls": PropTypes.string
};

The reason is because no-unused-prop-types ignores validation when it finds object spread:
https://github.com/yannickcr/eslint-plugin-react/blob/9258d796b2544fcee5980bca3b343e3dc8e7e3a2/lib/rules/no-unused-prop-types.js#L722-L725
Whereas prop-types doesn't:
https://github.com/yannickcr/eslint-plugin-react/blob/9258d796b2544fcee5980bca3b343e3dc8e7e3a2/lib/rules/prop-types.js#L702-L704

Not sure how to reconcile this.

@alexzherdev alexzherdev force-pushed the used-prop-types-refactoring branch 3 times, most recently from b04f017 to a5a278f Compare August 16, 2018 05:54
@alexzherdev alexzherdev force-pushed the used-prop-types-refactoring branch from a5a278f to 35f717c Compare August 19, 2018 06:00
@alexzherdev alexzherdev changed the base branch from 1674-prop-types-refactoring to master August 19, 2018 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant