@@ -33,7 +33,7 @@ module.exports = {
3333 } ]
3434 } ,
3535
36- create : Components . detect ( function ( context , components , utils ) {
36+ create : Components . detect ( ( context , components , utils ) => {
3737 const configuration = context . options [ 0 ] || { } ;
3838 const allowRequiredDefaults = configuration . allowRequiredDefaults || false ;
3939 const propWrapperFunctions = new Set ( context . settings . propWrapperFunctions || [ ] ) ;
@@ -139,7 +139,7 @@ module.exports = {
139139
140140 function resolveUnionTypeAnnotation ( node ) {
141141 // Go through all the union and resolve any generic types.
142- return node . types . map ( function ( annotation ) {
142+ return node . types . map ( annotation => {
143143 if ( annotation . type === 'GenericTypeAnnotation' ) {
144144 return resolveGenericTypeAnnotation ( annotation ) ;
145145 }
@@ -154,11 +154,9 @@ module.exports = {
154154 * @returns {Object[] } Array of PropType object representations, to be consumed by `addPropTypesToComponent`.
155155 */
156156 function getPropTypesFromObjectExpression ( objectExpression ) {
157- const props = objectExpression . properties . filter ( function ( property ) {
158- return property . type !== 'ExperimentalSpreadProperty' ;
159- } ) ;
157+ const props = objectExpression . properties . filter ( property => property . type !== 'ExperimentalSpreadProperty' ) ;
160158
161- return props . map ( function ( property ) {
159+ return props . map ( property => {
162160 return {
163161 name : property . key . name ,
164162 isRequired : isRequiredPropType ( property . value ) ,
@@ -188,7 +186,7 @@ module.exports = {
188186
189187 case 'UnionTypeAnnotation' :
190188 const union = resolveUnionTypeAnnotation ( node . typeAnnotation ) ;
191- properties = union . reduce ( function ( acc , curr ) {
189+ properties = union . reduce ( ( acc , curr ) => {
192190 if ( ! curr ) {
193191 return acc ;
194192 }
@@ -206,11 +204,9 @@ module.exports = {
206204 break ;
207205 }
208206
209- const props = properties . filter ( function ( property ) {
210- return property . type === 'ObjectTypeProperty' ;
211- } ) ;
207+ const props = properties . filter ( property => property . type === 'ObjectTypeProperty' ) ;
212208
213- return props . map ( function ( property ) {
209+ return props . map ( property => {
214210 // the `key` property is not present in ObjectTypeProperty nodes, so we need to get the key name manually.
215211 const tokens = context . getFirstTokens ( property , 1 ) ;
216212 const name = tokens [ 0 ] . value ;
@@ -237,7 +233,7 @@ module.exports = {
237233 return 'unresolved' ;
238234 }
239235
240- return objectExpression . properties . map ( function ( defaultProp ) {
236+ return objectExpression . properties . map ( defaultProp => {
241237 return {
242238 name : defaultProp . key . name ,
243239 node : defaultProp
@@ -348,7 +344,7 @@ module.exports = {
348344 return ;
349345 }
350346
351- defaultProps . forEach ( function ( defaultProp ) {
347+ defaultProps . forEach ( defaultProp => {
352348 const prop = propFromName ( propTypes , defaultProp . name ) ;
353349
354350 if ( prop && ( allowRequiredDefaults || ! prop . isRequired ) ) {
@@ -567,7 +563,7 @@ module.exports = {
567563 }
568564
569565 // Search for the proptypes declaration
570- node . properties . forEach ( function ( property ) {
566+ node . properties . forEach ( property => {
571567 if ( property . type === 'ExperimentalSpreadProperty' ) {
572568 return ;
573569 }
0 commit comments