diff --git a/packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js b/packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js new file mode 100644 index 000000000000..b7df325b06f2 --- /dev/null +++ b/packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js @@ -0,0 +1,24 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + */ + +// This fork provides www-specific feature flag values for +// eslint-plugin-react-hooks without pulling in the full +// ReactFeatureFlags.www.js fork. The full fork imports dynamic flags +// via require('ReactFeatureFlags'), which is a www Haste module that +// doesn't exist in Node.js environments where the ESLint plugin runs. +// +// Only eprh_* flags are needed by the ESLint plugin. + +export const eprh_enableUseKeyedStateCompilerLint: boolean = true; +export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = true; +export const eprh_enableExhaustiveEffectDependenciesCompilerLint: + | 'off' + | 'all' + | 'extra-only' + | 'missing-only' = 'extra-only'; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index c38c32a9e865..4b42d7811b87 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -114,13 +114,16 @@ export const enableFragmentRefsInstanceHandles: boolean = true; export const enableOptimisticKey: boolean = false; -export const eprh_enableUseKeyedStateCompilerLint: boolean = true; -export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = true; +// These flags are only used by eslint-plugin-react-hooks, which has its own +// fork at ReactFeatureFlags.eslint-plugin.www.js with the www-specific values. +// Edit that file to change the www values for these flags. +export const eprh_enableUseKeyedStateCompilerLint: boolean = false; +export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = false; export const eprh_enableExhaustiveEffectDependenciesCompilerLint: | 'off' | 'all' | 'extra-only' - | 'missing-only' = 'extra-only'; + | 'missing-only' = 'off'; // Flow magic to verify the exports of this file match the original version. ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 33c7c96abbc0..2120b370ad34 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -163,6 +163,14 @@ const forks = Object.freeze({ `Unexpected entry (${entry}) and bundleType (${bundleType})` ); } + case 'eslint-plugin-react-hooks/src/index.ts': + switch (bundleType) { + case FB_WWW_DEV: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + return './packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js'; + } + return null; case 'react-test-renderer': switch (bundleType) { case RN_FB_DEV: