Skip to content

Commit 36c8aed

Browse files
author
Joachim Seminck
committed
Add another invalid test case, using the example from the issue
1 parent b92f2c6 commit 36c8aed

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/lib/rules/prop-types.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -1692,8 +1692,7 @@ ruleTester.run('prop-types', rule, {
16921692
}
16931693
`,
16941694
parser: 'babel-eslint'
1695-
},
1696-
{
1695+
}, {
16971696
code: `
16981697
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): CpmponentType<P> => (
16991698
class extends React.Component<P> {
@@ -3324,6 +3323,24 @@ ruleTester.run('prop-types', rule, {
33243323
message: '\'bar\' is missing in props validation'
33253324
}],
33263325
parser: 'babel-eslint'
3326+
}, {
3327+
code: `
3328+
const withOverlayState = <P: {foo: string}>(WrappedComponent: ComponentType<P>): CpmponentType<P> => (
3329+
class extends React.Component<P> {
3330+
constructor(props) {
3331+
super(props);
3332+
this.state = {foo: props.foo, bar: props.bar}
3333+
}
3334+
render() {
3335+
return <div>Hello World</div>
3336+
}
3337+
}
3338+
)
3339+
`,
3340+
errors: [{
3341+
message: '\'bar\' is missing in props validation'
3342+
}],
3343+
parser: 'babel-eslint'
33273344
}
33283345
]
33293346
});

0 commit comments

Comments
 (0)