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

default-props-match-prop-types doesn't detect properties in quotes #1908

Closed
zech opened this issue Jul 30, 2018 · 2 comments · Fixed by #2001
Closed

default-props-match-prop-types doesn't detect properties in quotes #1908

zech opened this issue Jul 30, 2018 · 2 comments · Fixed by #2001

Comments

@zech
Copy link

zech commented Jul 30, 2018

Hello,

same as in issue #1201 last year the above mentioned rule doesn't detect quoted properties. The error for the second and third property is defaultProp "undefined" defined for isRequired propType. (react/default-props-match-prop-types)

SomeComponent.propTypes = {
    "firstProperty": PropTypes.string.isRequired,
    "secondProperty": PropTypes.bool,
    "thirdProperty": PropTypes.func
};

SomeComponent.defaultProps = {
    "secondProperty": false,
    "thirdProperty": () => undefined
};

As before removing the quotes solves the error. But I don't think this should be consistent and a non issue.

@alexzherdev
Copy link
Contributor

alexzherdev commented Aug 6, 2018

This one will get automatically fixed when this rule uses the common detection logic from #1911.

alexzherdev added a commit to alexzherdev/eslint-plugin-react that referenced this issue Sep 22, 2018
alexzherdev added a commit to alexzherdev/eslint-plugin-react that referenced this issue Sep 27, 2018
@jfrej
Copy link

jfrej commented Oct 16, 2018

What are the plans for releasing the fix?

I need this for data- prefixed props, which have to be quoted.

For example:

SomeComponent.propTypes = {
    'data-testid': PropTypes.string,
};

SomeComponent.defaultProps = {
    'data-testid': undefined,
};

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.

4 participants