Skip to content

Commit d22d2fa

Browse files
sawyerhfkling
authored andcommitted
Add support for new prop-types package (#172)
Resolves #171
1 parent 6520d78 commit d22d2fa

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

src/__tests__/__snapshots__/main-test.js.snap

+34
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,37 @@ Object {
128128
},
129129
}
130130
`;
131+
132+
exports[`main fixtures processes component "component_6.js" without errors 1`] = `
133+
Object {
134+
"description": "",
135+
"methods": Array [],
136+
"props": Object {
137+
"children": Object {
138+
"description": "",
139+
"required": true,
140+
"type": Object {
141+
"name": "string",
142+
},
143+
},
144+
"onClick": Object {
145+
"description": "",
146+
"required": false,
147+
"type": Object {
148+
"name": "func",
149+
},
150+
},
151+
"style": Object {
152+
"defaultValue": Object {
153+
"computed": false,
154+
"value": "{}",
155+
},
156+
"description": "",
157+
"required": false,
158+
"type": Object {
159+
"name": "object",
160+
},
161+
},
162+
},
163+
}
164+
`;

src/__tests__/fixtures/component_6.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
const Button = ({ children, onClick, style = {} }) => (
5+
<button
6+
style={{ }}
7+
onClick={onClick}
8+
>
9+
{children}
10+
</button>
11+
);
12+
13+
Button.propTypes = {
14+
children: PropTypes.string.isRequired,
15+
onClick: PropTypes.func,
16+
style: PropTypes.object,
17+
};
18+
19+
export default Button;

src/utils/isReactModuleName.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*/
1212

13-
var reactModules = ['react', 'react/addons', 'react-native', 'proptypes'];
13+
var reactModules = ['react', 'react/addons', 'react-native', 'proptypes', 'prop-types'];
1414

1515
/**
1616
* Takes a module name (string) and returns true if it refers to a root react

0 commit comments

Comments
 (0)