Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isCreateContext.js
rd565449 r0c6b92a 1 1 'use strict'; 2 3 const astUtil = require('./ast'); 2 4 3 5 /** 4 6 * Checks if the node is a React.createContext call 5 7 * @param {ASTNode} node - The AST node being checked. 6 * @returns { Boolean} - True if node is a React.createContext call, false if not.8 * @returns {boolean} - True if node is a React.createContext call, false if not. 7 9 */ 8 10 module.exports = function isCreateContext(node) { 9 11 if ( 10 12 node.init 11 && node.init.type === 'CallExpression'12 13 && node.init.callee 13 && node.init.callee.name === 'createContext'14 14 ) { 15 return true; 16 } 15 if ( 16 astUtil.isCallExpression(node.init) 17 && node.init.callee.name === 'createContext' 18 ) { 19 return true; 20 } 17 21 18 if ( 19 node.init 20 && node.init.callee 21 && node.init.callee.type === 'MemberExpression' 22 && node.init.callee.property 23 && node.init.callee.property.name === 'createContext' 24 ) { 25 return true; 22 if ( 23 node.init.callee.type === 'MemberExpression' 24 && node.init.callee.property 25 && node.init.callee.property.name === 'createContext' 26 ) { 27 return true; 28 } 26 29 } 27 30 … … 30 33 && node.expression.type === 'AssignmentExpression' 31 34 && node.expression.operator === '=' 32 && node.expression.right.type === 'CallExpression'35 && astUtil.isCallExpression(node.expression.right) 33 36 && node.expression.right.callee 34 && node.expression.right.callee.name === 'createContext'35 37 ) { 36 return true; 37 } 38 const right = node.expression.right; 38 39 39 if (40 node.expression41 && node.expression.type === 'AssignmentExpression'42 && node.expression.operator === '=' 43 && node.expression.right.type === 'CallExpression'44 && node.expression.right.callee45 && node.expression.right.callee.type === 'MemberExpression'46 && node.expression.right.callee.property47 && node.expression.right.callee.property.name === 'createContext'48 ) {49 return true;40 if (right.callee.name === 'createContext') { 41 return true; 42 } 43 44 if ( 45 right.callee.type === 'MemberExpression' 46 && right.callee.property 47 && right.callee.property.name === 'createContext' 48 ) { 49 return true; 50 } 50 51 } 51 52
Note:
See TracChangeset
for help on using the changeset viewer.