Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/util/Components.js
rd565449 r0c6b92a 71 71 * 72 72 * @param {ASTNode} node The AST node being added. 73 * @param { Number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes)73 * @param {number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes) 74 74 * @returns {Object} Added component object 75 75 */ … … 184 184 * Components for which we are not confident are not counted 185 185 * 186 * @returns { Number} Components list length186 * @returns {number} Components list length 187 187 */ 188 188 length() { … … 304 304 305 305 /** 306 * @param {ASTNode} ASTNode306 * @param {ASTNode} node 307 307 * @param {boolean=} strict 308 308 * @returns {boolean} 309 309 */ 310 isReturningJSX( ASTNode, strict) {311 return jsxUtil.isReturningJSX(context, ASTNode, strict, true);312 }, 313 314 isReturningJSXOrNull( ASTNode, strict) {315 return jsxUtil.isReturningJSX(context, ASTNode, strict);316 }, 317 318 isReturningOnlyNull( ASTNode) {319 return jsxUtil.isReturningOnlyNull( ASTNode, context);310 isReturningJSX(node, strict) { 311 return jsxUtil.isReturningJSX(context, node, strict, true); 312 }, 313 314 isReturningJSXOrNull(node, strict) { 315 return jsxUtil.isReturningJSX(context, node, strict); 316 }, 317 318 isReturningOnlyNull(node) { 319 return jsxUtil.isReturningOnlyNull(node, context); 320 320 }, 321 321 … … 408 408 409 409 isPragmaComponentWrapper(node) { 410 if (! node || node.type !== 'CallExpression') {410 if (!astUtil.isCallExpression(node)) { 411 411 return false; 412 412 } … … 568 568 569 569 // for case abc = { [someobject.somekey]: props => { ... return not-jsx } } 570 if (node.parent && node.parent.key && node.parent.key.type === 'MemberExpression' && !utils.isReturningJSX(node) && !utils.isReturningOnlyNull(node)) { 570 if ( 571 node.parent 572 && node.parent.key 573 && node.parent.key.type === 'MemberExpression' 574 && !utils.isReturningJSX(node) 575 && !utils.isReturningOnlyNull(node) 576 ) { 571 577 return undefined; 572 578 } … … 578 584 ) 579 585 ) { 580 if (isFirstLetterCapitalized(node.parent.key.name) && utils.isReturningJSX(node)) { 586 if ( 587 isFirstLetterCapitalized(node.parent.key.name) 588 && utils.isReturningJSX(node) 589 ) { 581 590 return node; 582 591 } … … 642 651 * 643 652 * @param {ASTNode} node The AST node being checked (must be a MemberExpression). 644 * @returns {ASTNode } component node, null if we cannot find the component653 * @returns {ASTNode | null} component node, null if we cannot find the component 645 654 */ 646 655 getRelatedComponent(node) { … … 752 761 * @param {ASTNode} node The AST node being searched. (expects CallExpression) 753 762 * @param {('useCallback'|'useContext'|'useDebugValue'|'useEffect'|'useImperativeHandle'|'useLayoutEffect'|'useMemo'|'useReducer'|'useRef'|'useState')[]} [expectedHookNames] React hook names to which search is limited. 754 * @returns { Boolean} True if the node is a call to a React hook763 * @returns {boolean} True if the node is a call to a React hook 755 764 */ 756 765 isReactHookCall(node, expectedHookNames) { 757 if ( node.type !== 'CallExpression') {766 if (!astUtil.isCallExpression(node)) { 758 767 return false; 759 768 } … … 799 808 800 809 const hookResolvedDefs = potentialHookReference && potentialHookReference.resolved.defs; 801 const localHookName = (isPotentialReactHookCall && node.callee.property.name) 802 || (isPotentialHookCall && potentialHookReference && node.callee.name); 810 const localHookName = ( 811 isPotentialReactHookCall 812 && node.callee.property.name 813 ) || ( 814 isPotentialHookCall 815 && potentialHookReference 816 && node.callee.name 817 ); 803 818 const isHookShadowed = isPotentialHookCall 804 819 && hookResolvedDefs … … 877 892 } 878 893 879 node = utils.getStatelessComponent(node);880 if (! node) {881 return; 882 } 883 components.add( node, 2);894 const cNode = utils.getStatelessComponent(node); 895 if (!cNode) { 896 return; 897 } 898 components.add(cNode, 2); 884 899 }, 885 900
Note:
See TracChangeset
for help on using the changeset viewer.