File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
1414
1515### Changed
1616* [ Docs] [ ` jsx-newline ` ] : Fix minor spelling error on rule name ([ #2974 ] [ ] @DennisSkoko )
17+ * [ Refactor] [ ` void-dom-elements-no-children ` ] : improve performance
1718
19+ [ #2977 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2977
1820[ #2975 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2975
1921[ #2974 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2974
2022[ #2972 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2972
Original file line number Diff line number Diff line change @@ -393,25 +393,29 @@ function componentRule(rule, context) {
393393 * @returns {Boolean } True if createElement called from pragma
394394 */
395395 isCreateElement ( node ) {
396- const calledOnPragma = (
396+ // match `React.createElement()`
397+ if (
397398 node
398399 && node . callee
399400 && node . callee . object
400401 && node . callee . object . name === pragma
401402 && node . callee . property
402403 && node . callee . property . name === 'createElement'
403- ) ;
404+ ) {
405+ return true ;
406+ }
404407
405- const calledDirectly = (
408+ // match `createElement()`
409+ if (
406410 node
407411 && node . callee
408412 && node . callee . name === 'createElement'
409- ) ;
410-
411- if ( this . isDestructuredFromPragmaImport ( 'createElement' ) ) {
412- return calledDirectly || calledOnPragma ;
413+ && this . isDestructuredFromPragmaImport ( 'createElement' )
414+ ) {
415+ return true ;
413416 }
414- return calledOnPragma ;
417+
418+ return false ;
415419 } ,
416420
417421 /**
You can’t perform that action at this time.
0 commit comments