Skip to content

Commit

Permalink
Use filter instead of if/return
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzherdev committed Sep 27, 2018
1 parent 5211a2b commit d8a615f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/rules/default-props-match-prop-types.js
Expand Up @@ -82,12 +82,8 @@ module.exports = {
'Program:exit': function() {
const list = components.list();

Object.keys(list).forEach(component => {
// If no defaultProps could be found, we don't report anything.
if (!list[component].defaultProps) {
return;
}

// If no defaultProps could be found, we don't report anything.
Object.keys(list).filter(component => list[component].defaultProps).forEach(component => {
reportInvalidDefaultProps(
list[component].declaredPropTypes,
list[component].defaultProps || {}
Expand Down

0 comments on commit d8a615f

Please sign in to comment.