Skip to content

Commit

Permalink
[Tests] add passing test for #1685
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 20, 2018
1 parent 4e059ea commit b7665b7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4355,6 +4355,28 @@ ruleTester.run('no-unused-prop-types', rule, {
errors: [{
message: '\'doSomething\' PropType is defined but prop is never used'
}]
}, {
// issue #1685
code: [
'class MyComponent extends React.Component {',
' onFoo() {',
' this.setState(prevState => ({',
' doSomething: prevState.doSomething + 1,',
' }));',
' }',
' render() {',
' return (',
' <div onClick={this.onFoo}>Test</div>',
' );',
' }',
'}',
'MyComponent.propTypes = {',
' doSomething: PropTypes.func',
'};'
].join('\n'),
errors: [{
message: '\'doSomething\' PropType is defined but prop is never used'
}]
}, {
code: `
type Props = {
Expand Down

0 comments on commit b7665b7

Please sign in to comment.