Skip to content

Commit

Permalink
[no-unused-prop-types] test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaSuvorova committed Aug 4, 2017
1 parent 95acd93 commit cbd4d74
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/lib/rules/no-unused-prop-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,63 @@ ruleTester.run('no-unused-prop-types', rule, {
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
// issue #1002
code: [
' type User = {',
' country: string;',
' };',

' export default ({ user }: { user: User }) => (',
' <div>',
' { user.country }',
' </div>',
' );'
].join('\n'),
parser: 'babel-eslint'
}, {
// issue #1008
code: [
'type ObjectType = {',
' usedDirectly: string;',
' usedFromArray: string;',
'};',

'export class UseDirectly extends React.Component {',
' props: {',
' object: ObjectType;',
' }',

' render() {',
' console.log(this.props.object.usedDirectly);',
' return null;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
}, {
// issue #1323
code: [
'type AProps = {',
' name: string;',
' age: number;',
'};',

'type BProps = {',
' greeting: string;',
'};',

'type Props = AProps & BProps;',

'class Hello extends React.Component {',
' props: Props;',

' render () {',
' return <div>{this.props.greeting}, {this.props.name}</div>;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
}
],

Expand Down

0 comments on commit cbd4d74

Please sign in to comment.