Skip to content

Commit

Permalink
[Test] no-unused-prop-types: add test assigning this.props to a var…
Browse files Browse the repository at this point in the history
…iable

Closes #2177.
  • Loading branch information
jzabala authored and ljharb committed Aug 2, 2020
1 parent 90d2cdf commit 5a00096
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 @@ -3667,6 +3667,28 @@ ruleTester.run('no-unused-prop-types', rule, {
};
`,
parser: parsers['@TYPESCRIPT_ESLINT']
},
{
code: `
class App extends Component {
static propTypes = {
notifications: PropTypes.array.isRequired
};
customizeNotifications() {
const props = this.props;
return props.notifications.map((notification) => notification);
}
render() {
const notifications = this.customizeNotifications();
return (
<View>
{notifications.map((notification) => <Text>{notification}</Text>)}
</View>
);
}
}
`,
parser: parsers.BABEL_ESLINT
}
])
),
Expand Down

0 comments on commit 5a00096

Please sign in to comment.