Skip to content

Commit 44ca52b

Browse files
authored
Merge pull request #1381 from DianaSuvorova/i106
[prop-types, no-unused-prop-types] test case
2 parents 162b92b + a049714 commit 44ca52b

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,6 +2029,31 @@ ruleTester.run('no-unused-prop-types', rule, {
20292029
].join('\n'),
20302030
parser: 'babel-eslint',
20312031
options: [{skipShapeProps: false}]
2032+
}, {
2033+
// issue #106
2034+
code: `
2035+
import React from 'react';
2036+
import SharedPropTypes from './SharedPropTypes';
2037+
2038+
export default class A extends React.Component {
2039+
render() {
2040+
return (
2041+
<span
2042+
a={this.props.a}
2043+
b={this.props.b}
2044+
c={this.props.c}>
2045+
{this.props.children}
2046+
</span>
2047+
);
2048+
}
2049+
}
2050+
2051+
A.propTypes = {
2052+
a: React.PropTypes.string,
2053+
...SharedPropTypes // eslint-disable-line object-shorthand
2054+
};
2055+
`,
2056+
parser: 'babel-eslint'
20322057
}
20332058
],
20342059

tests/lib/rules/prop-types.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,33 @@ ruleTester.run('prop-types', rule, {
15681568
`function Foo(props) {
15691569
props.bar = 'bar';
15701570
return <div {...props} />;
1571-
}`
1571+
}`,
1572+
{
1573+
// issue #106
1574+
code: `
1575+
import React from 'react';
1576+
import SharedPropTypes from './SharedPropTypes';
1577+
1578+
export default class A extends React.Component {
1579+
render() {
1580+
return (
1581+
<span
1582+
a={this.props.a}
1583+
b={this.props.b}
1584+
c={this.props.c}>
1585+
{this.props.children}
1586+
</span>
1587+
);
1588+
}
1589+
}
1590+
1591+
A.propTypes = {
1592+
a: React.PropTypes.string,
1593+
...SharedPropTypes // eslint-disable-line object-shorthand
1594+
};
1595+
`,
1596+
parser: 'babel-eslint'
1597+
}
15721598
],
15731599

15741600
invalid: [

0 commit comments

Comments
 (0)