Awesome Reviewers

Reviewer · Configurations

Consistent feature flag gating

When gating code behind a feature flag, keep the flag check as its own top-level `if` statement with all dependent logic nested inside it, rather than combining the flag with other conditions in a single `&&` expression. This keeps the gate structure consistent with the rest of the codebase and ensures the flag can be correctly dead-code-eliminated during...

Instruction

When gating code behind a feature flag, keep the flag check as its own top-level if statement with all dependent logic nested inside it, rather than combining the flag with other conditions in a single && expression. This keeps the gate structure consistent with the rest of the codebase and ensures the flag can be correctly dead-code-eliminated during builds. For example, prefer:

if (enableFragmentRefsTextNodes) {
  if (child.tag === HostText) {
    // ...
  }
}

over:

if (enableFragmentRefsTextNodes && child.tag === HostText) {
  // ...
}

This pattern must also be applied consistently across all call sites that share the same gated behavior (e.g., dev-only guards around a shared function should wrap every call site, not just some), so that the flag’s effect is uniform and predictable throughout the codebase.