Skip to content

Conversation

@aubreyquinn
Copy link
Collaborator

The issue was caused by faulty logic in the rule body with conditionals.

e.g.

What happened before

if (node.name.type === JSXIdentifier && node.name.name !== "DialogBody") {
  return;
}

<DialogBody> → true && false → do not return → rule runs ✅
<Foo> → true && true → return ✅
<React.StrictMode> → false && … → do not return → rule runs ❌ (bug)

The first operand is false for JSXMemberExpression, so the whole if is false and you don’t return, meaning the rule keeps running on <React.StrictMode>.

What the new guard does

const isDialogBody =
  node.name.type === AST_NODE_TYPES.JSXIdentifier &&
  node.name.name === "DialogBody";

if (!isDialogBody) return;


<DialogBody> → true && true → isDialogBody = true → do not return → rule runs ✅

<Foo> → true && false → isDialogBody = false → return ✅

<React.StrictMode> → false && … → isDialogBody = false → return ✅

Now you only proceed when it’s exactly a JSXIdentifier("DialogBody"); everything else (including JSXMemberExpression) exits early. That’s why it fixes the squiggle on <React.StrictMode>.

@aubreyquinn aubreyquinn changed the title fixed issue 136 Fixes #123 Sep 15, 2025
@aubreyquinn aubreyquinn changed the title Fixes #123 Fixes #136 Sep 15, 2025
@aubreyquinn aubreyquinn merged commit ab7833e into main Sep 15, 2025
11 checks passed
@aubreyquinn aubreyquinn deleted the users/aubreyquinn/reactStrictModeBug branch September 15, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants