Skip to content

Commit 077e017

Browse files
committed
Create failing no-unused-prop-types test with union flowtypes
1 parent 16e57ff commit 077e017

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
@@ -1097,6 +1097,28 @@ ruleTester.run('no-unused-prop-types', rule, {
10971097
'}'
10981098
].join('\n'),
10991099
parser: 'babel-eslint'
1100+
}, {
1101+
code: [
1102+
'type PropsUnionA = {',
1103+
' a: string,',
1104+
' b?: void,',
1105+
'};',
1106+
'type PropsUnionB = {',
1107+
' a?: void,',
1108+
' b: string,',
1109+
'};',
1110+
'type Props = {',
1111+
' name: string,',
1112+
'} & (PropsUnionA | PropsUnionB);',
1113+
'class Hello extends React.Component {',
1114+
' props: Props;',
1115+
' render() {',
1116+
' const {name} = this.props;',
1117+
' return name;',
1118+
' }',
1119+
'}'
1120+
].join('\n'),
1121+
parser: 'babel-eslint'
11001122
}, {
11011123
code: [
11021124
'Card.propTypes = {',

0 commit comments

Comments
 (0)