11/*
2- * Copyright (c) 2015, Facebook, Inc.
3- * All rights reserved.
2+ * Copyright (c) 2015, Facebook, Inc.
3+ * All rights reserved.
44 *
5- * This source code is licensed under the BSD-style license found in the
6- * LICENSE file in the root directory of this source tree. An additional grant
7- * of patent rights can be found in the PATENTS file in the same directory.
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree. An additional grant
7+ * of patent rights can be found in the PATENTS file in the same directory.
88 *
9- */
10-
11- /**
129 * @flow
10+ *
1311 */
14- "use strict" ;
1512
16- var getMembers = require ( './getMembers' ) ;
17- var getPropertyName = require ( './getPropertyName' ) ;
18- var printValue = require ( './printValue' ) ;
19- var recast = require ( 'recast' ) ;
20- var resolveToValue = require ( './resolveToValue' ) ;
13+ /*eslint no-use-before-define: 0*/
2114
22- var types = recast . types . namedTypes ;
15+
16+ import getMembers from './getMembers' ;
17+ import getPropertyName from './getPropertyName' ;
18+ import printValue from './printValue' ;
19+ import recast from 'recast' ;
20+ import resolveToValue from './resolveToValue' ;
21+
22+ var { types : { namedTypes : types } } = recast ;
2323
2424function getEnumValues ( path ) {
2525 return path . get ( 'elements' ) . map ( function ( elementPath ) {
2626 return {
2727 value : printValue ( elementPath ) ,
28- computed : ! types . Literal . check ( elementPath . node )
28+ computed : ! types . Literal . check ( elementPath . node ) ,
2929 } ;
3030 } ) ;
3131}
@@ -85,7 +85,7 @@ function getPropTypeShape(argumentPath) {
8585function getPropTypeInstanceOf ( argumentPath ) {
8686 return {
8787 name : 'instanceOf' ,
88- value : printValue ( argumentPath )
88+ value : printValue ( argumentPath ) ,
8989 } ;
9090}
9191
@@ -98,15 +98,15 @@ var simplePropTypes = {
9898 string : 1 ,
9999 any : 1 ,
100100 element : 1 ,
101- node : 1
101+ node : 1 ,
102102} ;
103103
104104var propTypes = {
105105 oneOf : getPropTypeOneOf ,
106106 oneOfType : getPropTypeOneOfType ,
107107 instanceOf : getPropTypeInstanceOf ,
108108 arrayOf : getPropTypeArrayOf ,
109- shape : getPropTypeShape
109+ shape : getPropTypeShape ,
110110} ;
111111
112112/**
@@ -117,7 +117,7 @@ var propTypes = {
117117 *
118118 * If there is no match, "custom" is returned.
119119 */
120- function getPropType ( path : NodePath ) : PropTypeDescriptor {
120+ export default function getPropType ( path : NodePath ) : PropTypeDescriptor {
121121 var node = path . node ;
122122 var descriptor ;
123123 getMembers ( path ) . some ( member => {
@@ -150,5 +150,3 @@ function getPropType(path: NodePath): PropTypeDescriptor {
150150 }
151151 return descriptor ;
152152}
153-
154- module . exports = getPropType ;
0 commit comments