Skip to content

Add ReactFeatureFlags support to eprh#651

Open
everettbu wants to merge 1 commit into
mainfrom
compiler-feature-flags
Open

Add ReactFeatureFlags support to eprh#651
everettbu wants to merge 1 commit into
mainfrom
compiler-feature-flags

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35951
Original author: jackpope


We're currently hardcoding experimental options to eslint-plugin-react-hooks. This blocks the release on features that might not be ready.

This PR extends the ReactFeatureFlag infra to support flags for eslint-plugin-react-hooks. An alternative would be to create a separate flag system for build tools, but for now we have a small number of these and reusing existing infra seems like the simplest approach.

I ran a full yarn build and checked the output resolved the flag values as expected:

build/oss-stable-semver/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js

var eprh_enableUseKeyedStateCompilerLint = false;
var eprh_enableVerboseNoSetStateInEffectCompilerLint = false;
var eprh_enableExhaustiveEffectDependenciesCompilerLint = 'off';

build/facebook-www/ESLintPluginReactHooks-dev.classic.js

var eprh_enableUseKeyedStateCompilerLint = true;
var eprh_enableVerboseNoSetStateInEffectCompilerLint = true;
var eprh_enableExhaustiveEffectDependenciesCompilerLint = 'extra-only';

@greptile-apps

greptile-apps Bot commented Mar 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR extends the ReactFeatureFlags infrastructure to support flags for eslint-plugin-react-hooks, replacing previously hardcoded experimental compiler options (enableUseKeyedState, enableVerboseNoSetStateInEffect, validateExhaustiveEffectDependencies) with build-channel-aware feature flags. This unblocks release by allowing experimental features to be enabled only in www builds while remaining off in OSS stable/experimental builds.

  • Three new eprh_* feature flags added to ReactFeatureFlags.js and all fork files, with www fork enabling them (true/true/'extra-only') and all others defaulting to off
  • New FB_WWW_DEV and FB_WWW_PROD bundle types added for eslint-plugin-react-hooks so the www build resolves flags from ReactFeatureFlags.www.js
  • Rollup build pipeline updated so the flow-remove-types plugin runs on .js files (like ReactFeatureFlags.js forks) even in TypeScript bundles
  • scripts/flags/flags.js updated to accept string-typed flag values for the new eprh_enableExhaustiveEffectDependenciesCompilerLint flag
  • CI workflow updated to handle the new www build artifact, though the file path references have issues (flagged in prior review)

Confidence Score: 3/5

  • Core feature flag and build infrastructure changes are sound, but the CI workflow has path issues that will cause the www artifact copy step to fail at runtime.
  • The feature flag infrastructure, rollup build changes, and code in RunReactCompiler.ts are all well-structured and correct. However, the CI workflow file has filename and path errors (already flagged in prior review) that will cause the sed and cp commands to fail when processing the www build artifact. These issues affect the artifact publishing pipeline but not the build correctness itself.
  • .github/workflows/runtime_commit_artifacts.yml has incorrect file paths for the FB_WWW build artifact (issues previously flagged).

Important Files Changed

Filename Overview
.github/workflows/runtime_commit_artifacts.yml Adds FB_WWW eslint-plugin build to artifact workflow, but references incorrect filename and copies from already-moved directory (issues flagged in prior review).
packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts Replaces hardcoded experimental compiler options with imports from ReactFeatureFlags, enabling per-build-channel configuration.
packages/shared/ReactFeatureFlags.js Adds three new eprh_* feature flags for eslint-plugin-react-hooks compiler lint options, defaulting to off/false.
packages/shared/forks/ReactFeatureFlags.www.js Sets eprh flags to enabled values (true/true/'extra-only') for facebook-www builds, matching the previously hardcoded behavior.
scripts/rollup/build.js Restructured plugin pipeline so both TypeScript and flow-remove-types plugins can coexist — flow removal now runs on .js files even in TS bundles, enabling ReactFeatureFlags.js forks to be properly processed.
scripts/rollup/bundles.js Adds FB_WWW_DEV and FB_WWW_PROD bundle types to eslint-plugin-react-hooks, enabling separate www builds with feature flags resolved from the www fork.

Last reviewed commit: 3a98f69

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread .github/workflows/runtime_commit_artifacts.yml
Comment thread .github/workflows/runtime_commit_artifacts.yml
@everettbu
everettbu force-pushed the compiler-feature-flags branch from ff343c6 to 3a98f69 Compare March 3, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants