diff --git a/tests/lib/rules/no-unused-prop-types.js b/tests/lib/rules/no-unused-prop-types.js index 97ce57bebd..5eaf90de0d 100644 --- a/tests/lib/rules/no-unused-prop-types.js +++ b/tests/lib/rules/no-unused-prop-types.js @@ -1119,6 +1119,17 @@ ruleTester.run('no-unused-prop-types', rule, { '}' ].join('\n'), parser: 'babel-eslint' + }, { + code: [ + 'import type { FieldProps } from "redux-form"', + '', + 'type Props = {', + 'label: string,', + ' type: string,', + ' options: Array', + '} & FieldProps' + ].join('\n'), + parser: 'babel-eslint' }, { code: [ 'Card.propTypes = {', diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index c16b7065f5..08153a711a 100644 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -1151,6 +1151,17 @@ ruleTester.run('prop-types', rule, { '}' ].join('\n'), parser: 'babel-eslint' + }, { + code: [ + 'import type { FieldProps } from "redux-form"', + '', + 'type Props = {', + 'label: string,', + ' type: string,', + ' options: Array', + '} & FieldProps' + ].join('\n'), + parser: 'babel-eslint' }, { code: [ 'Card.propTypes = {', @@ -1699,7 +1710,7 @@ ruleTester.run('prop-types', rule, { class Bar extends React.Component { props: Props; - + render() { return
{this.props.foo} - {this.props.bar}
} @@ -1715,7 +1726,7 @@ ruleTester.run('prop-types', rule, { class Bar extends React.Component { props: Props & PropsC; - + render() { return
{this.props.foo} - {this.props.bar} - {this.props.zap}
} @@ -1731,7 +1742,7 @@ ruleTester.run('prop-types', rule, { class Bar extends React.Component { props: Props & PropsC; - + render() { return
{this.props.foo} - {this.props.bar} - {this.props.zap}
} @@ -1743,12 +1754,12 @@ ruleTester.run('prop-types', rule, { type PropsA = { bar: string }; type PropsB = { zap: string }; type Props = PropsA & { - baz: string + baz: string }; class Bar extends React.Component { props: Props & PropsB; - + render() { return
{this.props.bar} - {this.props.zap} - {this.props.baz}
} @@ -1760,12 +1771,12 @@ ruleTester.run('prop-types', rule, { type PropsA = { bar: string }; type PropsB = { zap: string }; type Props = { - baz: string + baz: string } & PropsA; class Bar extends React.Component { props: Props & PropsB; - + render() { return
{this.props.bar} - {this.props.zap} - {this.props.baz}
} @@ -3453,7 +3464,7 @@ ruleTester.run('prop-types', rule, { class MyComponent extends React.Component { props: Props; - + render() { return
{this.props.foo} - {this.props.bar} - {this.props.fooBar}
} @@ -3472,7 +3483,7 @@ ruleTester.run('prop-types', rule, { class Bar extends React.Component { props: Props & PropsC; - + render() { return
{this.props.foo} - {this.props.bar} - {this.props.zap} - {this.props.fooBar}
} @@ -3487,12 +3498,12 @@ ruleTester.run('prop-types', rule, { type PropsB = { bar: string }; type PropsC = { zap: string }; type Props = PropsB & { - baz: string + baz: string }; class Bar extends React.Component { props: Props & PropsC; - + render() { return
{this.props.bar} - {this.props.baz} - {this.props.fooBar}
} @@ -3507,12 +3518,12 @@ ruleTester.run('prop-types', rule, { type PropsB = { bar: string }; type PropsC = { zap: string }; type Props = { - baz: string + baz: string } & PropsB; class Bar extends React.Component { props: Props & PropsC; - + render() { return
{this.props.bar} - {this.props.baz} - {this.props.fooBar}
}