Skip to content

Commit ab2276c

Browse files
authored
fix: skip function components without name in react-x/prefer-read-only-props (#1125)
1 parent bb55998 commit ab2276c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/prefer-read-only-props.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export function create(context: RuleContext<MessageID, []>): RuleListener {
4343
"Program:exit"(program) {
4444
const components = ctx.getAllComponents(program);
4545
for (const [, component] of components) {
46+
if (component.id == null) continue;
47+
if (component.name == null) continue;
4648
const [props] = component.node.params;
4749
if (props == null) {
4850
continue;

0 commit comments

Comments
 (0)