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
14
14
15
15
### Changed
16
16
* [ Docs] [ ` jsx-newline ` ] : Fix minor spelling error on rule name ([ #2974 ] [ ] @DennisSkoko )
17
+ * [ Refactor] [ ` void-dom-elements-no-children ` ] : improve performance
17
18
19
+ [ #2977 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2977
18
20
[ #2975 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2975
19
21
[ #2974 ] : https://github.com/yannickcr/eslint-plugin-react/pull/2974
20
22
[ #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) {
393
393
* @returns {Boolean } True if createElement called from pragma
394
394
*/
395
395
isCreateElement ( node ) {
396
- const calledOnPragma = (
396
+ // match `React.createElement()`
397
+ if (
397
398
node
398
399
&& node . callee
399
400
&& node . callee . object
400
401
&& node . callee . object . name === pragma
401
402
&& node . callee . property
402
403
&& node . callee . property . name === 'createElement'
403
- ) ;
404
+ ) {
405
+ return true ;
406
+ }
404
407
405
- const calledDirectly = (
408
+ // match `createElement()`
409
+ if (
406
410
node
407
411
&& node . callee
408
412
&& node . callee . name === 'createElement'
409
- ) ;
410
-
411
- if ( this . isDestructuredFromPragmaImport ( 'createElement' ) ) {
412
- return calledDirectly || calledOnPragma ;
413
+ && this . isDestructuredFromPragmaImport ( 'createElement' )
414
+ ) {
415
+ return true ;
413
416
}
414
- return calledOnPragma ;
417
+
418
+ return false ;
415
419
} ,
416
420
417
421
/**
You can’t perform that action at this time.
0 commit comments