Skip to content

Commit

Permalink
Fix isRequired tests after custom proptypes changes
Browse files Browse the repository at this point in the history
The typos were being ignored, because without `PropTypes`, the
un-namespaced identifiers looked like custom proptypes.
  • Loading branch information
brettdh authored and ljharb committed Feb 1, 2018
1 parent 4abebc3 commit ddba876
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions tests/lib/rules/no-typos.js
Original file line number Diff line number Diff line change
Expand Up @@ -899,33 +899,37 @@ ruleTester.run('no-typos', rule, {
message: 'Typo in declared prop type: objectof'
}]
}, {
code: `class Component extends React.Component {};
code: `
const PropTypes = require('prop-types');
class Component extends React.Component {};
Component.propTypes = {
a: string.isrequired,
b: shape({
c: number
a: PropTypes.string.isrequired,
b: PropTypes.shape({
c: PropTypes.number
}).isrequired
}
`,
parserOptions: parserOptions,
errors: [{
message: 'Typo in declared prop type: isrequired'
message: 'Typo in prop type chain qualifier: isrequired'
}, {
message: 'Typo in prop type chain qualifier: isrequired'
}]
}, {
code: `class Component extends React.Component {};
code: `
const PropTypes = require('prop-types');
class Component extends React.Component {};
Component.propTypes = {
a: string.isrequired,
b: shape({
c: number
a: PropTypes.string.isrequired,
b: PropTypes.shape({
c: PropTypes.number
}).isrequired
}
`,
parser: 'babel-eslint',
parserOptions: parserOptions,
errors: [{
message: 'Typo in declared prop type: isrequired'
message: 'Typo in prop type chain qualifier: isrequired'
}, {
message: 'Typo in prop type chain qualifier: isrequired'
}]
Expand Down

0 comments on commit ddba876

Please sign in to comment.