Skip to content

Commit d8a615f

Browse files
committed
Use filter instead of if/return
1 parent 5211a2b commit d8a615f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/rules/default-props-match-prop-types.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,8 @@ module.exports = {
8282
'Program:exit': function() {
8383
const list = components.list();
8484

85-
Object.keys(list).forEach(component => {
86-
// If no defaultProps could be found, we don't report anything.
87-
if (!list[component].defaultProps) {
88-
return;
89-
}
90-
85+
// If no defaultProps could be found, we don't report anything.
86+
Object.keys(list).filter(component => list[component].defaultProps).forEach(component => {
9187
reportInvalidDefaultProps(
9288
list[component].declaredPropTypes,
9389
list[component].defaultProps || {}

0 commit comments

Comments
 (0)