mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Flow: well formed exports for smaller packages (#25361)
Enforces well formed exports for packages where the fixes are small.
This commit is contained in:
@@ -57,7 +57,7 @@ function hookNamesModuleLoaderFunction() {
|
||||
);
|
||||
}
|
||||
|
||||
function setContentDOMNode(value: HTMLElement) {
|
||||
function setContentDOMNode(value: HTMLElement): typeof DevtoolsUI {
|
||||
node = value;
|
||||
|
||||
// Save so we can restore the exact waiting message between sessions.
|
||||
@@ -70,12 +70,14 @@ function setProjectRoots(value: Array<string>) {
|
||||
projectRoots = value;
|
||||
}
|
||||
|
||||
function setStatusListener(value: StatusListener) {
|
||||
function setStatusListener(value: StatusListener): typeof DevtoolsUI {
|
||||
statusListener = value;
|
||||
return DevtoolsUI;
|
||||
}
|
||||
|
||||
function setDisconnectedCallback(value: OnDisconnectedCallback) {
|
||||
function setDisconnectedCallback(
|
||||
value: OnDisconnectedCallback,
|
||||
): typeof DevtoolsUI {
|
||||
disconnectedCallback = value;
|
||||
return DevtoolsUI;
|
||||
}
|
||||
|
||||
2
packages/react-is/src/ReactIs.js
vendored
2
packages/react-is/src/ReactIs.js
vendored
@@ -26,7 +26,7 @@ import {
|
||||
} from 'shared/ReactSymbols';
|
||||
import isValidElementType from 'shared/isValidElementType';
|
||||
|
||||
export function typeOf(object: any) {
|
||||
export function typeOf(object: any): mixed {
|
||||
if (typeof object === 'object' && object !== null) {
|
||||
const $$typeof = object.$$typeof;
|
||||
switch ($$typeof) {
|
||||
|
||||
@@ -637,7 +637,12 @@ export function _getMountedRootCount(): number {
|
||||
// 'useState{[foo, setFoo]}(0)',
|
||||
// () => [useCustomHook], /* Lazy to avoid triggering inline requires */
|
||||
// );
|
||||
export function createSignatureFunctionForTransform() {
|
||||
export function createSignatureFunctionForTransform(): <T>(
|
||||
type: T,
|
||||
key: string,
|
||||
forceReset?: boolean,
|
||||
getCustomHooks?: () => Array<Function>,
|
||||
) => T | void {
|
||||
if (__DEV__) {
|
||||
let savedType;
|
||||
let hasCustomHooks;
|
||||
|
||||
@@ -122,12 +122,14 @@ function unsupportedRefresh(): void {
|
||||
|
||||
let currentCache: Map<Function, mixed> | null = null;
|
||||
|
||||
export function setCurrentCache(cache: Map<Function, mixed> | null) {
|
||||
export function setCurrentCache(
|
||||
cache: Map<Function, mixed> | null,
|
||||
): Map<Function, mixed> | null {
|
||||
currentCache = cache;
|
||||
return currentCache;
|
||||
}
|
||||
|
||||
export function getCurrentCache() {
|
||||
export function getCurrentCache(): Map<Function, mixed> | null {
|
||||
return currentCache;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,8 @@ import {useSyncExternalStore as builtInAPI} from 'react';
|
||||
|
||||
const shim = isServerEnvironment ? server : client;
|
||||
|
||||
export const useSyncExternalStore =
|
||||
builtInAPI !== undefined ? ((builtInAPI: any): typeof shim) : shim;
|
||||
export const useSyncExternalStore: <T>(
|
||||
subscribe: (() => void) => () => void,
|
||||
getSnapshot: () => T,
|
||||
getServerSnapshot?: () => T,
|
||||
) => T = builtInAPI !== undefined ? builtInAPI : shim;
|
||||
|
||||
@@ -48,43 +48,43 @@ munge_underscores=false
|
||||
types_first=false
|
||||
|
||||
well_formed_exports=true
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/dom-event-testing-library
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/eslint-plugin-react-hooks
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/jest-mock-scheduler
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/jest-react
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/dom-event-testing-library
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/eslint-plugin-react-hooks
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/jest-mock-scheduler
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/jest-react
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-art
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-cache
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-client
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-debug-tools
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-core
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-extensions
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-inline
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-art
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-cache
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-client
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-debug-tools
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-core
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-extensions
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-inline
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-shared
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-shell
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-devtools-timeline
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-dom
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-dom-bindings
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-fetch
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-fs
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-interactions
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-is
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-fetch
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-fs
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-interactions
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-is
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-native-renderer
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-noop-renderer
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-pg
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-noop-renderer
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-pg
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-reconciler
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-refresh
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-dom-relay
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-dom-webpack
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-native-relay
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-suspense-test-utils
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-refresh
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-dom-relay
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-dom-webpack
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-server-native-relay
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/react-suspense-test-utils
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/react-test-renderer
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/scheduler
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/shared
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/use-subscription
|
||||
; well_formed_exports.includes=<PROJECT_ROOT>/packages/use-sync-external-store
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/use-subscription
|
||||
well_formed_exports.includes=<PROJECT_ROOT>/packages/use-sync-external-store
|
||||
|
||||
# Substituted by createFlowConfig.js:
|
||||
%REACT_RENDERER_FLOW_OPTIONS%
|
||||
|
||||
Reference in New Issue
Block a user