File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const pragmaUtil = require('../util/pragma');
1313const report = require ( '../util/report' ) ;
1414const astUtil = require ( '../util/ast' ) ;
1515const getText = require ( '../util/eslint' ) . getText ;
16+ const isJSX = require ( '../util/jsx' ) . isJSX ;
1617
1718// ------------------------------------------------------------------------------
1819// Rule Definition
@@ -159,18 +160,17 @@ module.exports = {
159160 */
160161 function checkArrowFunctionWithJSX ( node ) {
161162 const isArrFn = node && node . type === 'ArrowFunctionExpression' ;
162- const shouldCheckNode = ( n ) => n && ( n . type === 'JSXElement' || n . type === 'JSXFragment' ) ;
163- if ( isArrFn && shouldCheckNode ( node . body ) ) {
163+ if ( isArrFn && isJSX ( node . body ) ) {
164164 checkIteratorElement ( node . body ) ;
165165 }
166166 if ( node . body . type === 'ConditionalExpression' ) {
167- if ( shouldCheckNode ( node . body . consequent ) ) {
167+ if ( isJSX ( node . body . consequent ) ) {
168168 checkIteratorElement ( node . body . consequent ) ;
169169 }
170- if ( shouldCheckNode ( node . body . alternate ) ) {
170+ if ( isJSX ( node . body . alternate ) ) {
171171 checkIteratorElement ( node . body . alternate ) ;
172172 }
173- } else if ( node . body . type === 'LogicalExpression' && shouldCheckNode ( node . body . right ) ) {
173+ } else if ( node . body . type === 'LogicalExpression' && isJSX ( node . body . right ) ) {
174174 checkIteratorElement ( node . body . right ) ;
175175 }
176176 }
You can’t perform that action at this time.
0 commit comments