Skip to content

support for custom propTypes with isRequired in no-typos #1652

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

Merged
merged 2 commits into from
Jan 21, 2018

Conversation

lfades
Copy link
Contributor

@lfades lfades commented Jan 20, 2018

fixes: #1607 and helps in #1389.

if will add support for the following cases:

{
  a: string.isRequired,
  b: customProp.isRequired,
  // added support for isRequired in call expressions. No validation is done inside
  c: PropTypes.shape({
    d: string
  }).isRequired
  e: customShape({
    f: number
  }).isRequired
}

for a custom prop type like string.isrequired the error message will be: Typo in declared prop type: isrequired because currently it doesn't know that it's a prop type cualifier

for call expressions like customShape({}).isrequired the error message will be Typo in prop type chain qualifier: isrequired and it will work as long as it's not something like customShape().number.isRequired

}).isRequired
}
`,
parser: 'babel-eslint',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add another test like this that uses the default parser

b: string.isrequired
}
`,
parser: 'babel-eslint',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with these 2 tests; please duplicate them so there's 1 for babel-eslint and 1 for the default parser.

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

Successfully merging this pull request may close these issues.

no-typos: false positive
5 participants