Skip to content

Commit 536bc35

Browse files
committed
[Tests] prop-types: add case from #2134
Closes #2134
1 parent df7ffc1 commit 536bc35

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/lib/rules/prop-types.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,6 +4414,34 @@ ruleTester.run('prop-types', rule, {
44144414
errors: [{
44154415
message: '\'a\' is missing in props validation'
44164416
}]
4417+
},
4418+
{
4419+
code: `
4420+
class Foo extends React.Component {
4421+
contructor(props) {
4422+
super(props);
4423+
this.initialValues = {
4424+
test: '',
4425+
};
4426+
}
4427+
4428+
render = () => {
4429+
return (
4430+
<Component
4431+
initialValues={this.props.initialValues || this.initialValues}
4432+
>
4433+
{formikProps => (
4434+
<Input {...formikProps} />
4435+
)}
4436+
</Component>
4437+
);
4438+
}
4439+
}
4440+
`,
4441+
parser: 'babel-eslint',
4442+
errors: [{
4443+
message: '\'initialValues\' is missing in props validation'
4444+
}]
44174445
}
44184446
]
44194447
});

0 commit comments

Comments
 (0)