From afda7619a5619f256feb8ae94faf0b42938e3fe8 Mon Sep 17 00:00:00 2001 From: Rel1cx Date: Fri, 6 Jun 2025 14:08:43 +0800 Subject: [PATCH] fix: skip function components without name in 'prefer-read-only-props' --- .../eslint-plugin-react-x/src/rules/prefer-read-only-props.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/plugins/eslint-plugin-react-x/src/rules/prefer-read-only-props.ts b/packages/plugins/eslint-plugin-react-x/src/rules/prefer-read-only-props.ts index 8cedcf112a..bd6ef2250f 100644 --- a/packages/plugins/eslint-plugin-react-x/src/rules/prefer-read-only-props.ts +++ b/packages/plugins/eslint-plugin-react-x/src/rules/prefer-read-only-props.ts @@ -43,6 +43,8 @@ export function create(context: RuleContext): RuleListener { "Program:exit"(program) { const components = ctx.getAllComponents(program); for (const [, component] of components) { + if (component.id == null) continue; + if (component.name == null) continue; const [props] = component.node.params; if (props == null) { continue;