Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/eslint-plugin-react/lib/util/Components.js

    rd565449 r0c6b92a  
    7171   *
    7272   * @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)
    7474   * @returns {Object} Added component object
    7575   */
     
    184184   * Components for which we are not confident are not counted
    185185   *
    186    * @returns {Number} Components list length
     186   * @returns {number} Components list length
    187187   */
    188188  length() {
     
    304304
    305305    /**
    306      * @param {ASTNode} ASTNode
     306     * @param {ASTNode} node
    307307     * @param {boolean=} strict
    308308     * @returns {boolean}
    309309     */
    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);
    320320    },
    321321
     
    408408
    409409    isPragmaComponentWrapper(node) {
    410       if (!node || node.type !== 'CallExpression') {
     410      if (!astUtil.isCallExpression(node)) {
    411411        return false;
    412412      }
     
    568568
    569569        // 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        ) {
    571577          return undefined;
    572578        }
     
    578584          )
    579585        ) {
    580           if (isFirstLetterCapitalized(node.parent.key.name) && utils.isReturningJSX(node)) {
     586          if (
     587            isFirstLetterCapitalized(node.parent.key.name)
     588            && utils.isReturningJSX(node)
     589          ) {
    581590            return node;
    582591          }
     
    642651     *
    643652     * @param {ASTNode} node The AST node being checked (must be a MemberExpression).
    644      * @returns {ASTNode} component node, null if we cannot find the component
     653     * @returns {ASTNode | null} component node, null if we cannot find the component
    645654     */
    646655    getRelatedComponent(node) {
     
    752761     * @param {ASTNode} node The AST node being searched. (expects CallExpression)
    753762     * @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 hook
     763     * @returns {boolean} True if the node is a call to a React hook
    755764     */
    756765    isReactHookCall(node, expectedHookNames) {
    757       if (node.type !== 'CallExpression') {
     766      if (!astUtil.isCallExpression(node)) {
    758767        return false;
    759768      }
     
    799808
    800809      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      );
    803818      const isHookShadowed = isPotentialHookCall
    804819        && hookResolvedDefs
     
    877892      }
    878893
    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);
    884899    },
    885900
Note: See TracChangeset for help on using the changeset viewer.