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');
13
13
const report = require ( '../util/report' ) ;
14
14
const astUtil = require ( '../util/ast' ) ;
15
15
const getText = require ( '../util/eslint' ) . getText ;
16
+ const isJSX = require ( '../util/jsx' ) . isJSX ;
16
17
17
18
// ------------------------------------------------------------------------------
18
19
// Rule Definition
@@ -159,18 +160,17 @@ module.exports = {
159
160
*/
160
161
function checkArrowFunctionWithJSX ( node ) {
161
162
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 ) ) {
164
164
checkIteratorElement ( node . body ) ;
165
165
}
166
166
if ( node . body . type === 'ConditionalExpression' ) {
167
- if ( shouldCheckNode ( node . body . consequent ) ) {
167
+ if ( isJSX ( node . body . consequent ) ) {
168
168
checkIteratorElement ( node . body . consequent ) ;
169
169
}
170
- if ( shouldCheckNode ( node . body . alternate ) ) {
170
+ if ( isJSX ( node . body . alternate ) ) {
171
171
checkIteratorElement ( node . body . alternate ) ;
172
172
}
173
- } else if ( node . body . type === 'LogicalExpression' && shouldCheckNode ( node . body . right ) ) {
173
+ } else if ( node . body . type === 'LogicalExpression' && isJSX ( node . body . right ) ) {
174
174
checkIteratorElement ( node . body . right ) ;
175
175
}
176
176
}
You can’t perform that action at this time.
0 commit comments