(path, name, module = 'react')
| 782 | } |
| 783 | |
| 784 | function isReactCall(path, name, module = 'react') { |
| 785 | if (!path.isCallExpression()) { |
| 786 | return false; |
| 787 | } |
| 788 | |
| 789 | let callee = path.node.callee; |
| 790 | let calleePath = path.get('callee'); |
| 791 | if (t.isTSAsExpression(callee)) { |
| 792 | callee = callee.expression; |
| 793 | calleePath = calleePath.get('expression'); |
| 794 | } |
| 795 | |
| 796 | if (!t.isMemberExpression(callee)) { |
| 797 | return calleePath.referencesImport(module, name); |
| 798 | } |
| 799 | |
| 800 | if (calleePath.get('object').referencesImport(module, 'default')) { |
| 801 | return t.isIdentifier(callee.property, {name}); |
| 802 | } |
| 803 | |
| 804 | return false; |
| 805 | } |
| 806 | |
| 807 | function isReactComponent(path) { |
| 808 | if (path.isFunction()) { |
no outgoing calls
no test coverage detected