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/rules/no-children-prop.js

    rd565449 r0c6b92a  
    1818 * @param {ASTNode} node - The AST node being checked.
    1919 * @param {Context} context - The AST node being checked.
    20  * @returns {Boolean} - True if node is a createElement call with a props
     20 * @returns {boolean} - True if node is a createElement call with a props
    2121 * object literal, False if not.
    2222*/
     
    3838};
    3939
     40/** @type {import('eslint').Rule.RuleModule} */
    4041module.exports = {
    4142  meta: {
     
    8788        }
    8889
    89         const props = node.arguments[1].properties;
    90         const childrenProp = props.find((prop) => prop.key && prop.key.name === 'children');
     90        const props = 'properties' in node.arguments[1] ? node.arguments[1].properties : undefined;
     91        const childrenProp = props.find((prop) => (
     92          'key' in prop
     93          && prop.key
     94          && 'name' in prop.key
     95          && prop.key.name === 'children'
     96        ));
    9197
    9298        if (childrenProp) {
    93           if (childrenProp.value && !isFunction(childrenProp.value)) {
     99          if ('value' in childrenProp && childrenProp.value && !isFunction(childrenProp.value)) {
    94100            report(context, messages.passChildrenAsArgs, 'passChildrenAsArgs', {
    95101              node,
Note: See TracChangeset for help on using the changeset viewer.