Skip to content

Commit f7441a9

Browse files
committed
Use declare const instead of declare var
1 parent a493901 commit f7441a9

File tree

14 files changed

+78
-78
lines changed

14 files changed

+78
-78
lines changed

packages/react-client/src/forks/ReactFlightClientConfig.custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// So `$$$config` looks like a global variable, but it's
2424
// really an argument to a top-level wrapping function.
2525

26-
declare var $$$config: any;
26+
declare const $$$config: any;
2727

2828
export opaque type ModuleLoading = mixed;
2929
export opaque type SSRModuleMap = mixed;

packages/react-devtools-extensions/flow-typed/jest.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ declare function beforeAll(
960960
): void;
961961

962962
/** A context for grouping tests together */
963-
declare var describe: {
963+
declare const describe: {
964964
/**
965965
* Creates a block that groups together several related tests in one "test suite"
966966
*/
@@ -991,7 +991,7 @@ declare var describe: {
991991
};
992992

993993
/** An individual test unit */
994-
declare var it: {
994+
declare const it: {
995995
/**
996996
* An individual test unit
997997
*
@@ -1079,15 +1079,15 @@ declare function fit(
10791079
timeout?: number
10801080
): void;
10811081
/** An individual test unit */
1082-
declare var test: typeof it;
1082+
declare const test: typeof it;
10831083
/** A disabled group of tests */
1084-
declare var xdescribe: typeof describe;
1084+
declare const xdescribe: typeof describe;
10851085
/** A focused group of tests */
1086-
declare var fdescribe: typeof describe;
1086+
declare const fdescribe: typeof describe;
10871087
/** A disabled individual test */
1088-
declare var xit: typeof it;
1088+
declare const xit: typeof it;
10891089
/** A disabled individual test */
1090-
declare var xtest: typeof it;
1090+
declare const xtest: typeof it;
10911091

10921092
type JestPrettyFormatColors = {
10931093
comment: {close: string, open: string},
@@ -1139,7 +1139,7 @@ type JestPrettyFormatPlugin = {
11391139
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
11401140

11411141
/** The expect function is used every time you want to test a value */
1142-
declare var expect: {
1142+
declare const expect: {
11431143
/** The object that you want to make assertions against */
11441144
(
11451145
value: any
@@ -1173,4 +1173,4 @@ declare var expect: {
11731173
};
11741174

11751175
/** Holds all functions related to manipulating test runner */
1176-
declare var jest: JestObjectType;
1176+
declare const jest: JestObjectType;

packages/react-native-renderer/src/ReactNativeTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export type NativeMethods = $ReadOnly<{|
125125
|}>;
126126

127127
// This validates that INativeMethods and NativeMethods stay in sync using Flow!
128-
declare var ensureNativeMethodsAreSynced: NativeMethods;
128+
declare const ensureNativeMethodsAreSynced: NativeMethods;
129129
(ensureNativeMethodsAreSynced: INativeMethods);
130130

131131
export type HostComponent<T> = AbstractComponent<T, $ReadOnly<NativeMethods>>;

packages/react-reconciler/src/ReactFiberDevToolsHook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
import {setSuppressWarning} from 'shared/consoleWithStackDev';
4242
import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev';
4343

44-
declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
44+
declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
4545

4646
let rendererID = null;
4747
let injectedHook = null;

packages/react-reconciler/src/forks/ReactFiberConfig.custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// So `$$$config` looks like a global variable, but it's
2424
// really an argument to a top-level wrapping function.
2525

26-
declare var $$$config: any;
26+
declare const $$$config: any;
2727
export opaque type Type = mixed; // eslint-disable-line no-undef
2828
export opaque type Props = mixed; // eslint-disable-line no-undef
2929
export opaque type Container = mixed; // eslint-disable-line no-undef

packages/react-server/src/ReactFlightServerConfigBundlerCustom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
declare var $$$config: any;
10+
declare const $$$config: any;
1111

1212
export opaque type ClientManifest = mixed;
1313
export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars

packages/react-server/src/forks/ReactFizzConfig.custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import type {Request} from 'react-server/src/ReactFizzServer';
2727
import type {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig';
2828

29-
declare var $$$config: any;
29+
declare const $$$config: any;
3030
export opaque type Destination = mixed; // eslint-disable-line no-undef
3131
export opaque type RenderState = mixed;
3232
export opaque type HoistableState = mixed;

packages/react-server/src/forks/ReactServerStreamConfig.custom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// So `$$$config` looks like a global variable, but it's
2424
// really an argument to a top-level wrapping function.
2525

26-
declare var $$$config: any;
26+
declare const $$$config: any;
2727
export opaque type Destination = mixed; // eslint-disable-line no-undef
2828

2929
export opaque type PrecomputedChunk = mixed; // eslint-disable-line no-undef

packages/scheduler/src/forks/SchedulerNative.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type NativeSchedulerType = {
3232
unstable_now: () => DOMHighResTimeStamp,
3333
};
3434

35-
declare var nativeRuntimeScheduler: void | NativeSchedulerType;
35+
declare const nativeRuntimeScheduler: void | NativeSchedulerType;
3636

3737
export const unstable_UserBlockingPriority: PriorityLevel =
3838
typeof nativeRuntimeScheduler !== 'undefined'

scripts/flow/environment.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@
99

1010
/* eslint-disable */
1111

12-
declare var __PROFILE__: boolean;
13-
declare var __UMD__: boolean;
14-
declare var __EXPERIMENTAL__: boolean;
15-
declare var __VARIANT__: boolean;
12+
declare const __PROFILE__: boolean;
13+
declare const __UMD__: boolean;
14+
declare const __EXPERIMENTAL__: boolean;
15+
declare const __VARIANT__: boolean;
1616

17-
declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
17+
declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
1818
inject: ?((stuff: Object) => void)
1919
};*/
2020

21-
declare var globalThis: Object;
21+
declare const globalThis: Object;
2222

23-
declare var queueMicrotask: (fn: Function) => void;
24-
declare var reportError: (error: mixed) => void;
25-
declare var AggregateError: Class<Error>;
23+
declare const queueMicrotask: (fn: Function) => void;
24+
declare const reportError: (error: mixed) => void;
25+
declare const AggregateError: Class<Error>;
2626

27-
declare var FinalizationRegistry: any;
27+
declare const FinalizationRegistry: any;
2828

2929
declare module 'create-react-class' {
30-
declare var exports: React$CreateClass;
30+
declare const exports: React$CreateClass;
3131
}
3232

3333
// Flow hides the props of React$Element, this overrides it to unhide
@@ -43,7 +43,7 @@ declare opaque type React$Element<
4343
+ref: any,
4444
};
4545

46-
declare var trustedTypes: {
46+
declare const trustedTypes: {
4747
isHTML: (value: any) => boolean,
4848
isScript: (value: any) => boolean,
4949
isScriptURL: (value: any) => boolean,
@@ -89,22 +89,22 @@ declare module 'EventListener' {
8989
}
9090

9191
declare function __webpack_chunk_load__(id: string): Promise<mixed>;
92-
declare var __webpack_require__: ((id: string) => any) & {
92+
declare const __webpack_require__: ((id: string) => any) & {
9393
u: string => string,
9494
};
9595

9696
declare function __turbopack_load__(id: string): Promise<mixed>;
97-
declare var __turbopack_require__: ((id: string) => any) & {
97+
declare const __turbopack_require__: ((id: string) => any) & {
9898
u: string => string,
9999
};
100100

101101
declare module 'fs/promises' {
102-
declare var access: (path: string, mode?: number) => Promise<void>;
103-
declare var lstat: (
102+
declare const access: (path: string, mode?: number) => Promise<void>;
103+
declare const lstat: (
104104
path: string,
105105
options?: ?{bigint?: boolean},
106106
) => Promise<mixed>;
107-
declare var readdir: (
107+
declare const readdir: (
108108
path: string,
109109
options?:
110110
| ?string
@@ -113,37 +113,37 @@ declare module 'fs/promises' {
113113
withFileTypes?: ?boolean,
114114
},
115115
) => Promise<Buffer>;
116-
declare var readFile: (
116+
declare const readFile: (
117117
path: string,
118118
options?:
119119
| ?string
120120
| {
121121
encoding?: ?string,
122122
},
123123
) => Promise<Buffer>;
124-
declare var readlink: (
124+
declare const readlink: (
125125
path: string,
126126
options?:
127127
| ?string
128128
| {
129129
encoding?: ?string,
130130
},
131131
) => Promise<mixed>;
132-
declare var realpath: (
132+
declare const realpath: (
133133
path: string,
134134
options?:
135135
| ?string
136136
| {
137137
encoding?: ?string,
138138
},
139139
) => Promise<mixed>;
140-
declare var stat: (
140+
declare const stat: (
141141
path: string,
142142
options?: ?{bigint?: boolean},
143143
) => Promise<mixed>;
144144
}
145145
declare module 'pg' {
146-
declare var Pool: (options: mixed) => {
146+
declare const Pool: (options: mixed) => {
147147
query: (query: string, values?: Array<mixed>) => void,
148148
};
149149
}
@@ -320,7 +320,7 @@ declare class AsyncLocalStorage<T> {
320320
enterWith(store: T): void;
321321
}
322322

323-
declare var async_hooks: {
323+
declare const async_hooks: {
324324
createHook(callbacks: any): any,
325325
executionAsyncId(): number,
326326
};
@@ -332,7 +332,7 @@ declare module 'node:worker_threads' {
332332
}
333333
}
334334

335-
declare var Bun: {
335+
declare const Bun: {
336336
hash(
337337
input: string | $TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
338338
): number,

0 commit comments

Comments
 (0)