Skip to content

Add ReactFeatureFlags support to eprh#35951

Open
jackpope wants to merge 1 commit intofacebook:mainfrom
jackpope:compiler-feature-flags
Open

Add ReactFeatureFlags support to eprh#35951
jackpope wants to merge 1 commit intofacebook:mainfrom
jackpope:compiler-feature-flags

Conversation

@jackpope
Copy link
Contributor

@jackpope jackpope commented Mar 3, 2026

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';

@meta-cla meta-cla bot added the CLA Signed label Mar 3, 2026
@jackpope jackpope requested a review from josephsavona March 3, 2026 15:55
Comment on lines +385 to +398
: false,
{
name: 'rollup-plugin-flow-remove-types',
transform(code, id) {
if (bundle.tsconfig != null && !id.endsWith('.js')) {
return null;
}
const transformed = flowRemoveTypes(code);
return {
code: transformed.toString(),
map: null,
};
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updates the build for eslint-plugin-react-hooks to run flowRemoveTypes on all .js files. Needed to support the import of feature flags.

@jackpope jackpope force-pushed the compiler-feature-flags branch from ff343c6 to e4a4adb Compare March 3, 2026 18:05
@jackpope jackpope force-pushed the compiler-feature-flags branch from e4a4adb to 3a98f69 Compare March 3, 2026 18:23
@react-sizebot
Copy link

Comparing: 4cc5b7a...3a98f69

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 611.79 kB 611.79 kB = 108.12 kB 108.12 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 677.72 kB 677.72 kB = 119.08 kB 119.08 kB
facebook-www/ReactDOM-prod.classic.js = 697.72 kB 697.72 kB = 122.59 kB 122.59 kB
facebook-www/ReactDOM-prod.modern.js = 688.03 kB 688.03 kB = 120.97 kB 120.97 kB
facebook-www/ESLintPluginReactHooks-dev.classic.js New file 0.00 kB 2,042.93 kB New file 0.00 kB 298.52 kB
facebook-www/ESLintPluginReactHooks-dev.modern.js New file 0.00 kB 2,042.93 kB New file 0.00 kB 298.52 kB
facebook-www/ESLintPluginReactHooks-prod.classic.js New file 0.00 kB 2,038.49 kB New file 0.00 kB 297.55 kB
facebook-www/ESLintPluginReactHooks-prod.modern.js New file 0.00 kB 2,038.49 kB New file 0.00 kB 297.55 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ESLintPluginReactHooks-dev.classic.js New file 0.00 kB 2,042.93 kB New file 0.00 kB 298.52 kB
facebook-www/ESLintPluginReactHooks-dev.modern.js New file 0.00 kB 2,042.93 kB New file 0.00 kB 298.52 kB
facebook-www/ESLintPluginReactHooks-prod.classic.js New file 0.00 kB 2,038.49 kB New file 0.00 kB 297.55 kB
facebook-www/ESLintPluginReactHooks-prod.modern.js New file 0.00 kB 2,038.49 kB New file 0.00 kB 297.55 kB

Generated by 🚫 dangerJS against 3a98f69

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