mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
Update react-docgen
This commit is contained in:
parent
b87ba87e47
commit
c0b0111e3a
@ -180,4 +180,16 @@ describe('propDocblockHandler', function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('does not error if propTypes cannot be found', function() {
|
||||
var definition = parse([
|
||||
'({',
|
||||
' fooBar: 42',
|
||||
'})',
|
||||
].join('\n'));
|
||||
|
||||
expect(function() {
|
||||
propDocblockHandler(documentation, definition);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
@ -188,4 +188,16 @@ describe('propTypeHandler', function() {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('does not error if propTypes cannot be found', function() {
|
||||
var definition = parse([
|
||||
'({',
|
||||
' fooBar: 42',
|
||||
'})',
|
||||
].join('\n'));
|
||||
|
||||
expect(function() {
|
||||
propTypeHandler(documentation, definition);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
@ -22,7 +22,11 @@ var types = require('recast').types.namedTypes;
|
||||
var resolveToValue = require('../utils/resolveToValue');
|
||||
|
||||
function propDocBlockHandler(documentation: Documentation, path: NodePath) {
|
||||
var propTypesPath = resolveToValue(getPropertyValuePath(path, 'propTypes'));
|
||||
var propTypesPath = getPropertyValuePath(path, 'propTypes');
|
||||
if (!propTypesPath) {
|
||||
return;
|
||||
}
|
||||
propTypesPath = resolveToValue(propTypesPath);
|
||||
if (!propTypesPath || !types.ObjectExpression.check(propTypesPath.node)) {
|
||||
return;
|
||||
}
|
||||
|
@ -100,7 +100,11 @@ function amendPropTypes(documentation, path) {
|
||||
}
|
||||
|
||||
function propTypeHandler(documentation: Documentation, path: NodePath) {
|
||||
var propTypesPath = resolveToValue(getPropertyValuePath(path, 'propTypes'));
|
||||
var propTypesPath = getPropertyValuePath(path, 'propTypes');
|
||||
if (!propTypesPath) {
|
||||
return;
|
||||
}
|
||||
propTypesPath = resolveToValue(propTypesPath);
|
||||
if (!propTypesPath || !types.ObjectExpression.check(propTypesPath.node)) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user