File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 7
7
const has = require ( 'has' ) ;
8
8
const astUtil = require ( '../util/ast' ) ;
9
9
const docsUrl = require ( '../util/docsUrl' ) ;
10
+ const pragma = require ( '../util/pragma' ) ;
10
11
11
12
// ------------------------------------------------------------------------------
12
13
// Rule Definition
@@ -66,7 +67,7 @@ module.exports = {
66
67
if ( obj && obj . name === 'Children' ) {
67
68
return true ;
68
69
}
69
- if ( obj && obj . object && obj . object . name === 'React' ) {
70
+ if ( obj && obj . object && obj . object . name === pragma . getFromContext ( context ) ) {
70
71
return true ;
71
72
}
72
73
@@ -161,20 +162,24 @@ module.exports = {
161
162
&& [ 'createElement' , 'cloneElement' ] . indexOf ( node . callee . property . name ) !== - 1
162
163
&& node . arguments . length > 1
163
164
) {
165
+ // React.createElement
164
166
if ( ! indexParamNames . length ) {
165
167
return ;
166
168
}
169
+
167
170
const props = node . arguments [ 1 ] ;
168
171
169
172
if ( props . type !== 'ObjectExpression' ) {
170
173
return ;
171
174
}
175
+
172
176
props . properties . forEach ( prop => {
173
177
if ( ! prop . key || prop . key . name !== 'key' ) {
174
178
// { ...foo }
175
179
// { foo: bar }
176
180
return ;
177
181
}
182
+
178
183
checkPropValue ( prop . value ) ;
179
184
} ) ;
180
185
You can’t perform that action at this time.
0 commit comments