diff --git a/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.spec.ts b/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.spec.ts
index 1800f3c02..a974cb50d 100644
--- a/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.spec.ts
+++ b/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.spec.ts
@@ -54,5 +54,10 @@ ruleTester.run(RULE_NAME, rule, {
return
;
}
`,
+ tsx`
+ function Component() {
+ return ;
+ }
+ `,
],
});
diff --git a/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.ts b/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.ts
index fb197becc..55a75617c 100644
--- a/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.ts
+++ b/packages/plugins/eslint-plugin-react-dom/src/rules/no-string-style-prop.ts
@@ -31,6 +31,7 @@ export default createRule<[], MessageID>({
export function create(context: RuleContext): RuleListener {
return {
JSXElement(node) {
+ if (!ER.isHostElement(context, node)) return;
const getAttribute = ER.getAttribute(context, node.openingElement.attributes, context.sourceCode.getScope(node));
const attribute = getAttribute("style");
if (attribute == null) return;