File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -151,11 +151,14 @@ module.exports = {
151151 } else if ( node . source && node . source . value === 'react' ) { // import { PropTypes } from "react"
152152 reactPackageName = node . specifiers [ 0 ] . local . name ;
153153
154- propTypesPackageName = node . specifiers . length >= 1 ? (
155- node . specifiers
156- . filter ( specifier => specifier . imported && specifier . imported . name === 'PropTypes' )
157- . map ( specifier => specifier . local . name )
158- ) [ 0 ] : null ;
154+ if ( node . specifiers . length >= 1 ) {
155+ const propTypesSpecifier = node . specifiers . find ( specifier => (
156+ specifier . imported && specifier . imported . name === 'PropTypes'
157+ ) ) ;
158+ if ( propTypesSpecifier ) {
159+ propTypesPackageName = propTypesSpecifier . local . name ;
160+ }
161+ }
159162 }
160163 } ,
161164
You can’t perform that action at this time.
0 commit comments