UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

26 lines (21 loc) 723 B
/** * @file Check if a CallExpression is a React component * @description Single responsibility: Determine if AST node represents a React component */ /** * Check if a CallExpression is a React component */ function isReactComponent(node) { if (!node.callee) return false; // Check for React.createElement or jsx calls if (node.callee.type === 'MemberExpression') { return node.callee.object.name === 'React' && node.callee.property.name === 'createElement'; } // Check for JSX function calls (usually starts with capital letter) if (node.callee.type === 'Identifier' && /^[A-Z]/.test(node.callee.name)) { return true; } return false; } module.exports = isReactComponent;