From d8a615f5857b7627b629ae98bc734fca6bcb03d4 Mon Sep 17 00:00:00 2001 From: Alex Zherdev Date: Wed, 26 Sep 2018 20:47:06 -0700 Subject: [PATCH] Use filter instead of if/return --- lib/rules/default-props-match-prop-types.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/rules/default-props-match-prop-types.js b/lib/rules/default-props-match-prop-types.js index 6270d2042d..cf1597a311 100644 --- a/lib/rules/default-props-match-prop-types.js +++ b/lib/rules/default-props-match-prop-types.js @@ -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 || {}