Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/shared/forks/ReactFeatureFlags.eslint-plugin.www.js
Original file line number Diff line number Diff line change
@@ -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';
9 changes: 6 additions & 3 deletions packages/shared/forks/ReactFeatureFlags.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
8 changes: 8 additions & 0 deletions scripts/rollup/forks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading