Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/no-children-prop.js
rd565449 r0c6b92a 18 18 * @param {ASTNode} node - The AST node being checked. 19 19 * @param {Context} context - The AST node being checked. 20 * @returns { Boolean} - True if node is a createElement call with a props20 * @returns {boolean} - True if node is a createElement call with a props 21 21 * object literal, False if not. 22 22 */ … … 38 38 }; 39 39 40 /** @type {import('eslint').Rule.RuleModule} */ 40 41 module.exports = { 41 42 meta: { … … 87 88 } 88 89 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 )); 91 97 92 98 if (childrenProp) { 93 if ( childrenProp.value && !isFunction(childrenProp.value)) {99 if ('value' in childrenProp && childrenProp.value && !isFunction(childrenProp.value)) { 94 100 report(context, messages.passChildrenAsArgs, 'passChildrenAsArgs', { 95 101 node,
Note:
See TracChangeset
for help on using the changeset viewer.