Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolveDefinition(definition, types) {
if (isReactCreateClassCall(definition)) {
// return argument
const resolvedPath = resolveToValue(definition.get('arguments', 0));
if (types.ObjectExpression.check(resolvedPath.node)) {
return resolvedPath;
}
} else if (isReactComponentClass(definition) || isDecoratedBy(definition, 'cn')) {
normalizeClassDefinition(definition);
return definition;
} else if (isStatelessComponent(definition)) {
return definition;
}
return null;
}
function resolveDefinition(definition, types) {
if (isReactCreateClassCall(definition)) {
// return argument
var resolvedPath = resolveToValue(definition.get('arguments', 0));
if (types.ObjectExpression.check(resolvedPath.node)) {
return resolvedPath;
}
} else if (isReactComponentClass(definition)) {
normalizeClassDefinition(definition);
return definition;
} else if (isStatelessComponent(definition)) {
return definition;
} else if (isSimpleTag(definition)) {
var resolvedPath = resolveToValue(definition.get('arguments', 0));
return resolvedPath;
} else if (isWithMDC(definition)) {
var resolvedPath = resolveToValue(definition.get('arguments', 0));
return resolvedPath;
function isComponentDefinition(path) {
return (
isReactCreateClassCall(path) ||
isReactComponentClass(path) ||
isStatelessComponent(path) ||
isSimpleTag(path) ||
isWithMDC(path)
);
}