Skip to content

Commit b7665b7

Browse files
committed
[Tests] add passing test for #1685
1 parent 4e059ea commit b7665b7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/lib/rules/no-unused-prop-types.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4355,6 +4355,28 @@ ruleTester.run('no-unused-prop-types', rule, {
43554355
errors: [{
43564356
message: '\'doSomething\' PropType is defined but prop is never used'
43574357
}]
4358+
}, {
4359+
// issue #1685
4360+
code: [
4361+
'class MyComponent extends React.Component {',
4362+
' onFoo() {',
4363+
' this.setState(prevState => ({',
4364+
' doSomething: prevState.doSomething + 1,',
4365+
' }));',
4366+
' }',
4367+
' render() {',
4368+
' return (',
4369+
' <div onClick={this.onFoo}>Test</div>',
4370+
' );',
4371+
' }',
4372+
'}',
4373+
'MyComponent.propTypes = {',
4374+
' doSomething: PropTypes.func',
4375+
'};'
4376+
].join('\n'),
4377+
errors: [{
4378+
message: '\'doSomething\' PropType is defined but prop is never used'
4379+
}]
43584380
}, {
43594381
code: `
43604382
type Props = {

0 commit comments

Comments
 (0)