diff --git a/packages/eslint-plugin-calcite-components/src/rules/enforce-ref-last-prop.ts b/packages/eslint-plugin-calcite-components/src/rules/enforce-ref-last-prop.ts index 70f9071749b..17a040121ef 100644 --- a/packages/eslint-plugin-calcite-components/src/rules/enforce-ref-last-prop.ts +++ b/packages/eslint-plugin-calcite-components/src/rules/enforce-ref-last-prop.ts @@ -17,13 +17,13 @@ const rule: Rule.RuleModule = { JSXIdentifier(node) { const openingElement = node.parent as JSXOpeningElement; if (openingElement.type === "JSXOpeningElement") { - const attributes: (JSXAttribute | JSXSpreadAttribute)[] = []; - - openingElement.attributes.forEach((attr: JSXAttribute | JSXSpreadAttribute) => { - if (attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier") { - attributes.push(attr); - } - }); + const attributes = openingElement.attributes + .map((attr) => { + if (attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier") { + return attr; + } + }) + .filter(Boolean); const refAttribute = attributes.find( (attr: JSXAttribute | JSXSpreadAttribute) =>