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 77const has = require ( 'has' ) ;
88const astUtil = require ( '../util/ast' ) ;
99const docsUrl = require ( '../util/docsUrl' ) ;
10+ const pragma = require ( '../util/pragma' ) ;
1011
1112// ------------------------------------------------------------------------------
1213// Rule Definition
@@ -66,7 +67,7 @@ module.exports = {
6667 if ( obj && obj . name === 'Children' ) {
6768 return true ;
6869 }
69- if ( obj && obj . object && obj . object . name === 'React' ) {
70+ if ( obj && obj . object && obj . object . name === pragma . getFromContext ( context ) ) {
7071 return true ;
7172 }
7273
@@ -161,20 +162,24 @@ module.exports = {
161162 && [ 'createElement' , 'cloneElement' ] . indexOf ( node . callee . property . name ) !== - 1
162163 && node . arguments . length > 1
163164 ) {
165+ // React.createElement
164166 if ( ! indexParamNames . length ) {
165167 return ;
166168 }
169+
167170 const props = node . arguments [ 1 ] ;
168171
169172 if ( props . type !== 'ObjectExpression' ) {
170173 return ;
171174 }
175+
172176 props . properties . forEach ( prop => {
173177 if ( ! prop . key || prop . key . name !== 'key' ) {
174178 // { ...foo }
175179 // { foo: bar }
176180 return ;
177181 }
182+
178183 checkPropValue ( prop . value ) ;
179184 } ) ;
180185
You can’t perform that action at this time.
0 commit comments