|
8 | 8 | const values = require('object.values'); |
9 | 9 |
|
10 | 10 | const Components = require('../util/Components'); |
| 11 | +const isCreateContext = require('../util/isCreateContext'); |
11 | 12 | const astUtil = require('../util/ast'); |
12 | 13 | const componentUtil = require('../util/componentUtil'); |
13 | 14 | const docsUrl = require('../util/docsUrl'); |
@@ -77,58 +78,6 @@ module.exports = { |
77 | 78 | return node.type === 'CallExpression' && argumentIsCallExpression && utils.isPragmaComponentWrapper(node); |
78 | 79 | } |
79 | 80 |
|
80 | | - /** |
81 | | - * Checks if the node is a React.createContext call |
82 | | - * @param {ASTNode} node - The AST node being checked. |
83 | | - * @returns {Boolean} - True if node is a React.createContext call, false if not. |
84 | | - */ |
85 | | - function isCreateContext(node) { |
86 | | - if ( |
87 | | - node.init |
88 | | - && node.init.type === 'CallExpression' |
89 | | - && node.init.callee |
90 | | - && node.init.callee.name === 'createContext' |
91 | | - ) { |
92 | | - return true; |
93 | | - } |
94 | | - |
95 | | - if ( |
96 | | - node.init |
97 | | - && node.init.callee |
98 | | - && node.init.callee.type === 'MemberExpression' |
99 | | - && node.init.callee.property |
100 | | - && node.init.callee.property.name === 'createContext' |
101 | | - ) { |
102 | | - return true; |
103 | | - } |
104 | | - |
105 | | - if ( |
106 | | - node.expression |
107 | | - && node.expression.type === 'AssignmentExpression' |
108 | | - && node.expression.operator === '=' |
109 | | - && node.expression.right.type === 'CallExpression' |
110 | | - && node.expression.right.callee |
111 | | - && node.expression.right.callee.name === 'createContext' |
112 | | - ) { |
113 | | - return true; |
114 | | - } |
115 | | - |
116 | | - if ( |
117 | | - node.expression |
118 | | - && node.expression.type === 'AssignmentExpression' |
119 | | - && node.expression.operator === '=' |
120 | | - && node.expression.right.type === 'CallExpression' |
121 | | - && node.expression.right.callee |
122 | | - && node.expression.right.callee.type === 'MemberExpression' |
123 | | - && node.expression.right.callee.property |
124 | | - && node.expression.right.callee.property.name === 'createContext' |
125 | | - ) { |
126 | | - return true; |
127 | | - } |
128 | | - |
129 | | - return false; |
130 | | - } |
131 | | - |
132 | 81 | /** |
133 | 82 | * Reports missing display name for a given component |
134 | 83 | * @param {Object} component The component to process |
|
0 commit comments