Registry Mirror
Skip to content

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict
8+
*/
9+
10+
// This fork provides www-specific feature flag values for
11+
// eslint-plugin-react-hooks without pulling in the full
12+
// ReactFeatureFlags.www.js fork. The full fork imports dynamic flags
13+
// via require('ReactFeatureFlags'), which is a www Haste module that
14+
// doesn't exist in Node.js environments where the ESLint plugin runs.
15+
//
16+
// Only eprh_* flags are needed by the ESLint plugin.
17+
18+
export const eprh_enableUseKeyedStateCompilerLint: boolean = true;
19+
export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = true;
20+
export const eprh_enableExhaustiveEffectDependenciesCompilerLint:
21+
| 'off'
22+
| 'all'
23+
| 'extra-only'
24+
| 'missing-only' = 'extra-only';

‎packages/shared/forks/ReactFeatureFlags.www.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,16 @@ export const enableFragmentRefsInstanceHandles: boolean = true;
114114

115115
export const enableOptimisticKey: boolean = false;
116116

117-
export const eprh_enableUseKeyedStateCompilerLint: boolean = true;
118-
export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = true;
117+
// These flags are only used by eslint-plugin-react-hooks, which has its own
118+
// fork at ReactFeatureFlags.eslint-plugin.www.js with the www-specific values.
119+
// Edit that file to change the www values for these flags.
120+
export const eprh_enableUseKeyedStateCompilerLint: boolean = false;
121+
export const eprh_enableVerboseNoSetStateInEffectCompilerLint: boolean = false;
119122
export const eprh_enableExhaustiveEffectDependenciesCompilerLint:
120123
| 'off'
121124
| 'all'
122125
| 'extra-only'
123-
| 'missing-only' = 'extra-only';
126+
| 'missing-only' = 'off';
124127

125128
// Flow magic to verify the exports of this file match the original version.
126129
((((null: any): ExportsType): FeatureFlagsType): ExportsType);

‎scripts/rollup/forks.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ const forks = Object.freeze({
163163
`Unexpected entry (${entry}) and bundleType (${bundleType})`
164164
);
165165
}
166+
case 'eslint-plugin-react-hooks/src/index.ts':
167+
switch (bundleType) {
168+
case FB_WWW_DEV:
169+
case FB_WWW_PROD:
170+
case FB_WWW_PROFILING:
171+
return './packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js';
172+
}
173+
return null;
166174
case 'react-test-renderer':
167175
switch (bundleType) {
168176
case RN_FB_DEV:

0 commit comments

Comments
 (0)