From 65af886291309f1fbdb84d3fe68f06c5bbf60ce8 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005232357 Date: Mon, 13 Jul 2026 16:42:37 -0700 Subject: [PATCH] Revert D111190630: Stop using `prettier-plugin-hermes-parser` for formatting Differential Revision: D111190630 Original commit changeset: e7ed7ee6f057 Original Phabricator Diff: D111190630 fbshipit-source-id: 49e33587fa084c181d64d35ac6bcf6ab73edfa5f --- .prettierrc.js | 8 +- flow-typed/environment/node.js | 48 +++++++--- flow-typed/npm/babel-traverse_v7.x.x.js | 18 +++- flow-typed/npm/babel_v7.x.x.js | 3 +- flow-typed/npm/commander_v12.x.x.js | 8 +- flow-typed/npm/electron-packager_v20.x.x.js | 11 ++- flow-typed/npm/execa_v5.x.x.js | 10 +- flow-typed/npm/jest.js | 5 +- flow-typed/npm/jsonc-parser_v2.2.x.js | 8 +- flow-typed/npm/node-fetch_v2.x.x.js | 14 ++- flow-typed/npm/pretty-format_v29.x.x.js | 4 +- flow-typed/npm/rxjs_v6.x.x.js | 26 ++--- flow-typed/npm/shelljs_v0.x.x.js | 9 +- flow-typed/npm/tinybench_v4.1.x.js | 4 +- .../src/inspector-proxy/CdpDebugLogging.js | 5 +- .../src/inspector-proxy/types.js | 9 +- .../platform-colors.js | 14 +-- .../react-native-modules.js | 22 +++-- packages/jest-preset/jest-preset.js | 5 +- packages/metro-config/src/index.flow.js | 10 +- .../react-native-codegen/src/CodegenSchema.js | 15 ++- .../src/parsers/flow/components/commands.js | 14 +-- .../parsers/typescript/components/commands.js | 16 ++-- .../typescript/components/componentsUtils.js | 6 +- .../react-native-codegen/src/parsers/utils.js | 22 +++-- .../src/ComparisonResult.js | 3 +- .../src/DiffResults.js | 4 +- .../react-native/Libraries/Alert/Alert.js | 5 +- .../Libraries/Animated/AnimatedEvent.js | 4 +- .../Animated/createAnimatedComponent.js | 27 +++--- .../Animated/nodes/AnimatedInterpolation.js | 4 +- .../Libraries/AppState/AppState.js | 6 +- .../Libraries/BatchedBridge/MessageQueue.js | 3 +- .../AccessibilityInfo/AccessibilityInfo.js | 5 +- .../Libraries/Components/Button.js | 3 +- .../Libraries/Components/Keyboard/Keyboard.js | 6 +- .../Components/Pressable/Pressable.js | 3 +- .../Components/ScrollView/ScrollView.js | 16 ++-- .../ScrollViewNativeComponentType.js | 5 +- .../Components/TextInput/TextInput.flow.js | 44 +++++++-- .../Components/TextInput/TextInput.js | 95 +++++++++---------- .../Components/Touchable/Touchable.js | 4 +- .../Touchable/TouchableNativeFeedback.js | 3 +- .../Touchable/TouchableWithoutFeedback.js | 5 +- .../EventEmitter/NativeEventEmitter.js | 3 +- .../__mocks__/NativeEventEmitter.js | 3 +- .../Libraries/Image/ImageSource.js | 4 +- .../react-native/Libraries/Modal/Modal.js | 5 +- .../Libraries/Network/XMLHttpRequest.js | 19 ++-- .../Libraries/Pressability/HoverState.js | 6 +- .../Libraries/StyleSheet/StyleSheetTypes.js | 40 ++++++-- .../StyleSheet/private/_TransformStyle.js | 6 +- .../StyleSheet/processBackgroundImage.js | 6 +- .../Libraries/Utilities/PlatformTypes.js | 13 ++- .../Utilities/useWindowDimensions.js | 3 +- packages/react-native/flow/bom.js.flow | 12 ++- packages/react-native/flow/cssom.js.flow | 12 ++- packages/react-native/flow/dom.js.flow | 71 ++++++++++---- .../scripts/compose-source-maps.js | 2 +- .../scripts/featureflags/types.js | 5 +- .../specs/NativeViewTransition.js | 2 +- .../webapis/dom/nodes/specs/NativeDOM.js | 24 ++--- .../__tests__/IntersectionObserver-itest.js | 14 +-- .../webapis/performance/PerformanceEntry.js | 6 +- .../PlatformTest/RNTesterPlatformTestTypes.js | 3 +- .../KeyboardAvoidingViewExample.js | 3 +- .../Lists/VirtualizeUtils.js | 20 ++-- .../Lists/VirtualizedList.js | 6 +- .../Lists/VirtualizedSectionList.js | 8 +- private/react-native-fantom/src/Benchmark.js | 3 +- 70 files changed, 579 insertions(+), 279 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 70a05cba5f4..dca775b0703 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -7,6 +7,11 @@ * @format */ +let plugins = ['prettier-plugin-hermes-parser']; +try { + plugins = require('./.prettier-plugins.fb.js'); +} catch {} + module.exports = { arrowParens: 'avoid', bracketSameLine: true, @@ -15,6 +20,7 @@ module.exports = { singleQuote: true, trailingComma: 'all', endOfLine: 'lf', + plugins, overrides: [ { files: ['*.code-workspace'], @@ -25,7 +31,7 @@ module.exports = { { files: ['*.js', '*.js.flow'], options: { - parser: 'flow', + parser: 'hermes', }, }, { diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index c92ff006df2..1a99ec0dcbd 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -457,7 +457,8 @@ declare class child_process$ChildProcessTyped< TStdin extends stream$Writable | null, TStdout extends stream$Readable | null, TStderr extends stream$Readable | null, -> extends events$EventEmitter { +> extends events$EventEmitter +{ +stdin: TStdin; +stdout: TStdout; +stderr: TStderr; @@ -577,7 +578,8 @@ declare module 'child_process' { declare function execFile( file: string, argsOrCallback?: - ReadonlyArray | child_process$execFileCallback, + | ReadonlyArray + | child_process$execFileCallback, callback?: child_process$execFileCallback, ): child_process$ChildProcessTyped< stream$Writable, @@ -926,7 +928,14 @@ type crypto$key = declare class crypto$KeyObject { +asymmetricKeyType?: - 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; + | 'rsa' + | 'rsa-pss' + | 'dsa' + | 'ec' + | 'ed25519' + | 'ed448' + | 'x25519' + | 'x448'; +asymmetricKeySize?: number; +symmetricKeySize?: number; +type: 'secret' | 'public' | 'private'; @@ -2551,9 +2560,9 @@ declare class http$Agent<+SocketT = net$Socket> { sockets: {[name: string]: ReadonlyArray, ...}; } -declare class http$IncomingMessage< - SocketT = net$Socket, -> extends stream$Readable { +declare class http$IncomingMessage + extends stream$Readable +{ headers: Object; rawHeaders: Array; httpVersion: string; @@ -2569,9 +2578,9 @@ declare class http$IncomingMessage< rawTrailers: Array; } -declare class http$ClientRequest< - +SocketT = net$Socket, -> extends stream$Writable { +declare class http$ClientRequest<+SocketT = net$Socket> + extends stream$Writable +{ abort(): void; aborted: boolean; +connection: SocketT | null; @@ -2869,7 +2878,10 @@ declare class net$Socket extends stream$Duplex { destroyed: boolean; end( chunkOrEncodingOrCallback?: - Buffer | Uint8Array | string | ((data: any) => void), + | Buffer + | Uint8Array + | string + | ((data: any) => void), encodingOrCallback?: string | ((data: any) => void), callback?: (data: any) => void, ): this; @@ -3199,9 +3211,9 @@ declare module 'perf_hooks' { +detail?: T; } - declare export class PerformanceMeasure< - T = unknown, - > extends PerformanceEntry { + declare export class PerformanceMeasure + extends PerformanceEntry + { +entryType: 'measure'; +detail?: T; } @@ -3386,7 +3398,11 @@ declare module 'querystring' { */ declare module 'node:sqlite' { declare export type SupportedValueType = - null | number | bigint | string | Uint8Array; + | null + | number + | bigint + | string + | Uint8Array; declare export type DatabaseSyncOptions = Readonly<{ open?: boolean, @@ -5549,7 +5565,9 @@ declare module 'repl' { writer?: (object: any, options?: util$InspectOptions) => string, completer?: readline$InterfaceCompleter, replMode?: - $SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict, + | $SymbolReplModeMagic + | $SymbolReplModeSloppy + | $SymbolReplModeStrict, breakEvalOnSigint?: boolean, ... }): REPLServer; diff --git a/flow-typed/npm/babel-traverse_v7.x.x.js b/flow-typed/npm/babel-traverse_v7.x.x.js index d3b6cd034c4..e28bb4921fe 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -246,7 +246,12 @@ declare module '@babel/traverse' { } declare export type BindingKind = - 'var' | 'let' | 'const' | 'module' | 'hoisted' | 'unknown'; + | 'var' + | 'let' + | 'const' + | 'module' + | 'hoisted' + | 'unknown'; declare export class Binding { constructor(opts: { @@ -430,7 +435,13 @@ declare module '@babel/traverse' { isBaseType(baseName: string, soft?: boolean): boolean; couldBeBaseType( name: - 'string' | 'number' | 'boolean' | 'any' | 'mixed' | 'empty' | 'void', + | 'string' + | 'number' + | 'boolean' + | 'any' + | 'mixed' + | 'empty' + | 'void', ): boolean; baseTypeStrictlyMatches(right: NodePath<>): ?boolean; isGenericType(genericName: string): boolean; @@ -1435,7 +1446,8 @@ declare module '@babel/traverse' { }>; declare export type VisitNode<-TNode extends BabelNode, TState> = - VisitNodeFunction | VisitNodeObject; + | VisitNodeFunction + | VisitNodeObject; declare export type Visitor = Readonly<{ enter?: VisitNodeFunction, diff --git a/flow-typed/npm/babel_v7.x.x.js b/flow-typed/npm/babel_v7.x.x.js index f58af46605e..abba5ac2cb6 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -1293,7 +1293,8 @@ declare module '@babel/template' { }; declare export type PublicReplacements = - {[string]: ?BabelNode} | Array; + | {[string]: ?BabelNode} + | Array; declare export type TemplateBuilder = { // Build a new builder, merging the given options with the previous ones. diff --git a/flow-typed/npm/commander_v12.x.x.js b/flow-typed/npm/commander_v12.x.x.js index d98bd1ed533..1f18ac9da05 100644 --- a/flow-typed/npm/commander_v12.x.x.js +++ b/flow-typed/npm/commander_v12.x.x.js @@ -15,7 +15,8 @@ declare module 'commander' { declare type LiteralUnion = - LiteralType | {...BaseType, ...{[key: empty]: empty, ...}}; + | LiteralType + | {...BaseType, ...{[key: empty]: empty, ...}}; declare export class CommanderError mixins Error { code: string; @@ -334,7 +335,10 @@ declare module 'commander' { outputError?: (str: string, write: (str: string) => void) => void; } export type AddHelpTextPosition = - 'beforeAll' | 'before' | 'after' | 'afterAll'; + | 'beforeAll' + | 'before' + | 'after' + | 'afterAll'; export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction'; export type OptionValueSource = LiteralUnion< 'default' | 'config' | 'env' | 'cli' | 'implied', diff --git a/flow-typed/npm/electron-packager_v20.x.x.js b/flow-typed/npm/electron-packager_v20.x.x.js index 86e3cfc25f1..38c859aca69 100644 --- a/flow-typed/npm/electron-packager_v20.x.x.js +++ b/flow-typed/npm/electron-packager_v20.x.x.js @@ -49,14 +49,21 @@ declare module '@electron/packager' { ProductName?: string, InternalName?: string, 'requested-execution-level'?: - 'asInvoker' | 'highestAvailable' | 'requireAdministrator', + | 'asInvoker' + | 'highestAvailable' + | 'requireAdministrator', 'application-manifest'?: string, }>; declare export type WindowsSignOptions = $FlowFixMe; declare export type OfficialArch = - 'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'universal'; + | 'ia32' + | 'x64' + | 'armv7l' + | 'arm64' + | 'mips64el' + | 'universal'; declare export type OfficialPlatform = 'linux' | 'win32' | 'darwin' | 'mas'; diff --git a/flow-typed/npm/execa_v5.x.x.js b/flow-typed/npm/execa_v5.x.x.js index a3a8dae8b4c..c54a07291e9 100644 --- a/flow-typed/npm/execa_v5.x.x.js +++ b/flow-typed/npm/execa_v5.x.x.js @@ -13,7 +13,12 @@ declare module 'execa' { declare type StdIoOption = - 'pipe' | 'ipc' | 'ignore' | 'inherit' | stream$Stream | number; + | 'pipe' + | 'ipc' + | 'ignore' + | 'inherit' + | stream$Stream + | number; declare type CommonOptions = { argv0?: string, @@ -69,7 +74,8 @@ declare module 'execa' { }; declare interface ExecaPromise - extends Promise, child_process$ChildProcess {} + extends Promise, + child_process$ChildProcess {} declare interface ExecaError extends ErrnoError { stdout: string; diff --git a/flow-typed/npm/jest.js b/flow-typed/npm/jest.js index 70597548c96..00767deaa1c 100644 --- a/flow-typed/npm/jest.js +++ b/flow-typed/npm/jest.js @@ -214,7 +214,10 @@ type FakeTimersConfig = { */ type JestStyledComponentsMatcherValue = - string | JestAsymmetricEqualityType | RegExp | void; + | string + | JestAsymmetricEqualityType + | RegExp + | void; type JestStyledComponentsMatcherOptions = { media?: string, diff --git a/flow-typed/npm/jsonc-parser_v2.2.x.js b/flow-typed/npm/jsonc-parser_v2.2.x.js index c8b47b6404e..51eadf91b48 100644 --- a/flow-typed/npm/jsonc-parser_v2.2.x.js +++ b/flow-typed/npm/jsonc-parser_v2.2.x.js @@ -155,7 +155,13 @@ declare module 'jsonc-parser' { | 'InvalidCharacter' | ''; export type NodeType = - 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null'; + | 'object' + | 'array' + | 'property' + | 'string' + | 'number' + | 'boolean' + | 'null'; export type Node = { type: NodeType, value?: any, diff --git a/flow-typed/npm/node-fetch_v2.x.x.js b/flow-typed/npm/node-fetch_v2.x.x.js index 22108efa6b7..5b6b9cc51b4 100644 --- a/flow-typed/npm/node-fetch_v2.x.x.js +++ b/flow-typed/npm/node-fetch_v2.x.x.js @@ -157,7 +157,12 @@ declare module 'node-fetch' { } declare type ResponseType = - 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; + | 'basic' + | 'cors' + | 'default' + | 'error' + | 'opaque' + | 'opaqueredirect'; declare interface ResponseInit { headers?: HeaderInit; @@ -167,7 +172,12 @@ declare module 'node-fetch' { declare type HeaderInit = Headers | Array; declare type BodyInit = - string | null | Buffer | Blob | Readable | URLSearchParams; + | string + | null + | Buffer + | Blob + | Readable + | URLSearchParams; declare function fetch( url: string | URL | Request, diff --git a/flow-typed/npm/pretty-format_v29.x.x.js b/flow-typed/npm/pretty-format_v29.x.x.js index fbcdfda1f5e..a13951717f0 100644 --- a/flow-typed/npm/pretty-format_v29.x.x.js +++ b/flow-typed/npm/pretty-format_v29.x.x.js @@ -37,7 +37,9 @@ declare type PrettyFormatPlugin = declare module 'pretty-format' { declare export type CompareKeys = - ((a: string, b: string) => number) | null | void; + | ((a: string, b: string) => number) + | null + | void; declare export function format( value: unknown, options?: ?{ diff --git a/flow-typed/npm/rxjs_v6.x.x.js b/flow-typed/npm/rxjs_v6.x.x.js index dfb0557cd72..a4326724e3e 100644 --- a/flow-typed/npm/rxjs_v6.x.x.js +++ b/flow-typed/npm/rxjs_v6.x.x.js @@ -9,14 +9,11 @@ declare interface rxjs$UnaryFunction { (source: T): R; } -declare interface rxjs$OperatorFunction extends rxjs$UnaryFunction< - rxjs$Observable, - rxjs$Observable, -> {} +declare interface rxjs$OperatorFunction + extends rxjs$UnaryFunction, rxjs$Observable> {} declare type rxjs$FactoryOrValue = T | (() => T); -declare interface rxjs$MonoTypeOperatorFunction< - T, -> extends rxjs$OperatorFunction {} +declare interface rxjs$MonoTypeOperatorFunction + extends rxjs$OperatorFunction {} declare interface rxjs$Timestamp { value: T; timestamp: number; @@ -50,7 +47,9 @@ declare interface rxjs$Subscribable { ): rxjs$Unsubscribable; } declare type rxjs$ObservableInput = - rxjs$SubscribableOrPromise | Array | Iterable; + | rxjs$SubscribableOrPromise + | Array + | Iterable; declare type rxjs$InteropObservable = { [string | unknown]: () => rxjs$Subscribable, @@ -589,7 +588,8 @@ declare module 'rxjs' { ((...sources: rxjs$ObservableInput[]) => rxjs$Observable), from( input: - rxjs$ObservableInput | rxjs$ObservableInput>, + | rxjs$ObservableInput + | rxjs$ObservableInput>, scheduler?: rxjs$SchedulerLike, ): rxjs$Observable, ArgumentOutOfRangeError: ArgumentOutOfRangeError, @@ -630,7 +630,9 @@ declare module 'rxjs' { ) => rxjs$Observable) & (( ...observables: ( - rxjs$ObservableInput | rxjs$SchedulerLike | number + | rxjs$ObservableInput + | rxjs$SchedulerLike + | number )[] ) => rxjs$Observable) & (( @@ -3347,7 +3349,9 @@ declare module 'rxjs/webSocket' { _output: rxjs$Subject; constructor( urlConfigOrSource: - string | WebSocketSubjectConfig | rxjs$Observable, + | string + | WebSocketSubjectConfig + | rxjs$Observable, destination?: rxjs$Observer, ): void; lift(operator: rxjs$Operator): WebSocketSubject; diff --git a/flow-typed/npm/shelljs_v0.x.x.js b/flow-typed/npm/shelljs_v0.x.x.js index 22eb29608ca..c5ffdee8061 100644 --- a/flow-typed/npm/shelljs_v0.x.x.js +++ b/flow-typed/npm/shelljs_v0.x.x.js @@ -48,7 +48,14 @@ declare type $npm$shelljs$GrepOpts = $npm$shelljs$OptionsPoly<'-l' | '-v'>; declare type $npm$shelljs$SedOpts = $npm$shelljs$OptionsPoly<'-i'>; declare type $npm$shelljs$SortOpts = $npm$shelljs$OptionsPoly<'-n' | '-r'>; declare type $npm$shelljs$TestOpts = - '-b' | '-c' | '-d' | '-e' | '-f' | '-L' | '-p' | '-S'; + | '-b' + | '-c' + | '-d' + | '-e' + | '-f' + | '-L' + | '-p' + | '-S'; declare type $npm$shelljs$TouchOpts = { [key: '-a' | '-c' | '-m']: boolean, '-d'?: string, diff --git a/flow-typed/npm/tinybench_v4.1.x.js b/flow-typed/npm/tinybench_v4.1.x.js index 821e79e0a96..2b6bbba9baf 100644 --- a/flow-typed/npm/tinybench_v4.1.x.js +++ b/flow-typed/npm/tinybench_v4.1.x.js @@ -101,7 +101,9 @@ declare module 'tinybench' { // but we type it this way to avoid mistakes (we can make breaking changes // in our definition that they can't). export type Fn = () => - Promise | void | FnReturnedObject; + | Promise + | void + | FnReturnedObject; declare export class Bench extends EventTarget { concurrency: null | 'task' | 'bench'; diff --git a/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js b/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js index b2a054a622c..056c07f76f0 100644 --- a/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js +++ b/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js @@ -21,7 +21,10 @@ const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages'); const CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS = 5000; export type CDPMessageDestination = - 'DebuggerToProxy' | 'ProxyToDebugger' | 'DeviceToProxy' | 'ProxyToDevice'; + | 'DebuggerToProxy' + | 'ProxyToDebugger' + | 'DeviceToProxy' + | 'ProxyToDevice'; function getCDPLogPrefix(destination: CDPMessageDestination): string { return util.format( diff --git a/packages/dev-middleware/src/inspector-proxy/types.js b/packages/dev-middleware/src/inspector-proxy/types.js index 707d19ed3bb..89838f2d11d 100644 --- a/packages/dev-middleware/src/inspector-proxy/types.js +++ b/packages/dev-middleware/src/inspector-proxy/types.js @@ -107,11 +107,16 @@ export type GetPagesResponse = { // Union type for all possible messages sent from device to Inspector Proxy. export type MessageFromDevice = - GetPagesResponse | WrappedEventFromDevice | DisconnectRequest; + | GetPagesResponse + | WrappedEventFromDevice + | DisconnectRequest; // Union type for all possible messages sent from Inspector Proxy to device. export type MessageToDevice = - GetPagesRequest | WrappedEventToDevice | ConnectRequest | DisconnectRequest; + | GetPagesRequest + | WrappedEventToDevice + | ConnectRequest + | DisconnectRequest; // Page description object that is sent in response to /json HTTP request from debugger. export type PageDescription = Readonly<{ diff --git a/packages/eslint-plugin-react-native/platform-colors.js b/packages/eslint-plugin-react-native/platform-colors.js index 2de452899cd..b154aabcbe5 100644 --- a/packages/eslint-plugin-react-native/platform-colors.js +++ b/packages/eslint-plugin-react-native/platform-colors.js @@ -58,12 +58,14 @@ module.exports = { } const properties = args[0].properties; properties.forEach(property => { - if (!( - property.type === 'Property' && - (property.value.type === 'Literal' || - (property.value.type === 'CallExpression' && - property.value.callee.name === 'PlatformColor')) - )) { + if ( + !( + property.type === 'Property' && + (property.value.type === 'Literal' || + (property.value.type === 'CallExpression' && + property.value.callee.name === 'PlatformColor')) + ) + ) { context.report({ node, messageId: 'dynamicColorIOSValue', diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 5983f10dc83..78e6e11559c 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -91,18 +91,22 @@ function isModuleRequire(node) { } const memberExpression = callExpression.callee; - if (!( - memberExpression.object.type === 'Identifier' && - memberExpression.object.name === 'TurboModuleRegistry' - )) { + if ( + !( + memberExpression.object.type === 'Identifier' && + memberExpression.object.name === 'TurboModuleRegistry' + ) + ) { return false; } - if (!( - memberExpression.property.type === 'Identifier' && - (memberExpression.property.name === 'get' || - memberExpression.property.name === 'getEnforcing') - )) { + if ( + !( + memberExpression.property.type === 'Identifier' && + (memberExpression.property.name === 'get' || + memberExpression.property.name === 'getEnforcing') + ) + ) { return false; } return true; diff --git a/packages/jest-preset/jest-preset.js b/packages/jest-preset/jest-preset.js index fc99494c37d..bfe131904a2 100644 --- a/packages/jest-preset/jest-preset.js +++ b/packages/jest-preset/jest-preset.js @@ -28,8 +28,9 @@ module.exports = { resolver: require.resolve('./jest/resolver.js'), transform: { '^.+\\.(js|ts|tsx)$': 'babel-jest', - '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': - require.resolve('./jest/assetFileTransformer.js'), + '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve( + './jest/assetFileTransformer.js', + ), }, transformIgnorePatterns: [ 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)', diff --git a/packages/metro-config/src/index.flow.js b/packages/metro-config/src/index.flow.js index 2f4e44c187b..74fc4053c2b 100644 --- a/packages/metro-config/src/index.flow.js +++ b/packages/metro-config/src/index.flow.js @@ -85,10 +85,12 @@ export function getDefaultConfig(projectRoot: string): ConfigT { transformer: { allowOptionalDependencies: true, assetRegistryPath: 'react-native/asset-registry', - asyncRequireModulePath: - require.resolve('metro-runtime/src/modules/asyncRequire'), - babelTransformerPath: - require.resolve('@react-native/metro-babel-transformer'), + asyncRequireModulePath: require.resolve( + 'metro-runtime/src/modules/asyncRequire', + ), + babelTransformerPath: require.resolve( + '@react-native/metro-babel-transformer', + ), getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 1c383704fd7..41b8edabf54 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -270,7 +270,8 @@ export type ReservedTypeAnnotation = Readonly<{ * NativeModule Types */ export type Nullable = - NullableTypeAnnotation | T; + | NullableTypeAnnotation + | T; export type NullableTypeAnnotation = Readonly<{ @@ -344,7 +345,8 @@ export type NativeModuleEnumMember = { }; export type NativeModuleEnumMemberType = - 'NumberTypeAnnotation' | 'StringTypeAnnotation'; + | 'NumberTypeAnnotation' + | 'StringTypeAnnotation'; export type NativeModuleEnumDeclaration = Readonly<{ name: string, @@ -434,10 +436,12 @@ export type NativeModuleBaseTypeAnnotation = | NativeModuleMixedTypeAnnotation; export type NativeModuleParamTypeAnnotation = - NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation; + | NativeModuleBaseTypeAnnotation + | NativeModuleParamOnlyTypeAnnotation; export type NativeModuleReturnTypeAnnotation = - NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation; + | NativeModuleBaseTypeAnnotation + | NativeModuleReturnOnlyTypeAnnotation; export type NativeModuleTypeAnnotation = | NativeModuleBaseTypeAnnotation @@ -448,7 +452,8 @@ export type NativeModuleTypeAnnotation = type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation; type NativeModuleReturnOnlyTypeAnnotation = - NativeModulePromiseTypeAnnotation | VoidTypeAnnotation; + | NativeModulePromiseTypeAnnotation + | VoidTypeAnnotation; // Add the allowed component reserved types to the native module union export type CompleteReservedTypeAnnotation = diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index 381fef3c88d..8800427a615 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -49,12 +49,14 @@ function buildCommandSchema( const firstParam = value.params[0].typeAnnotation; - if (!( - firstParam.id != null && - firstParam.id.type === 'QualifiedTypeIdentifier' && - firstParam.id.qualification.name === 'React' && - firstParam.id.id.name === 'ElementRef' - )) { + if ( + !( + firstParam.id != null && + firstParam.id.type === 'QualifiedTypeIdentifier' && + firstParam.id.qualification.name === 'React' && + firstParam.id.id.name === 'ElementRef' + ) + ) { throw new Error( `The first argument of method ${name} must be of type React.ElementRef<>`, ); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/commands.js b/packages/react-native-codegen/src/parsers/typescript/components/commands.js index f097b2b9314..f51d7ccede3 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -33,13 +33,15 @@ function buildCommandSchemaInternal( parser: Parser, ): NamedShape { const firstParam = parameters[0].typeAnnotation; - if (!( - firstParam.typeAnnotation != null && - firstParam.typeAnnotation.type === 'TSTypeReference' && - firstParam.typeAnnotation.typeName.left?.name === 'React' && - (firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' || - firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef') - )) { + if ( + !( + firstParam.typeAnnotation != null && + firstParam.typeAnnotation.type === 'TSTypeReference' && + firstParam.typeAnnotation.typeName.left?.name === 'React' && + (firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' || + firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef') + ) + ) { throw new Error( `The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`, ); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js index 407327d24c1..23d16906883 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -354,7 +354,8 @@ function setDefaultValue( /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition * roll out. See https://fburl.com/workplace/5whu3i34. */ (defaultValue === null ? null : defaultValue ? defaultValue : 0) as - number | null; + | number + | null; break; case 'BooleanTypeAnnotation': /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition @@ -363,7 +364,8 @@ function setDefaultValue( break; case 'StringTypeAnnotation': common.default = (defaultValue === undefined ? null : defaultValue) as - string | null; + | string + | null; break; } } diff --git a/packages/react-native-codegen/src/parsers/utils.js b/packages/react-native-codegen/src/parsers/utils.js index 3ddb518fbc3..851450b0b18 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -177,18 +177,22 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean { } const memberExpression = callExpression.callee; - if (!( - memberExpression.object.type === 'Identifier' && - memberExpression.object.name === 'TurboModuleRegistry' - )) { + if ( + !( + memberExpression.object.type === 'Identifier' && + memberExpression.object.name === 'TurboModuleRegistry' + ) + ) { return false; } - if (!( - memberExpression.property.type === 'Identifier' && - (memberExpression.property.name === 'get' || - memberExpression.property.name === 'getEnforcing') - )) { + if ( + !( + memberExpression.property.type === 'Identifier' && + (memberExpression.property.name === 'get' || + memberExpression.property.name === 'getEnforcing') + ) + ) { return false; } diff --git a/packages/react-native-compatibility-check/src/ComparisonResult.js b/packages/react-native-compatibility-check/src/ComparisonResult.js index 967206eaef6..40b4d934395 100644 --- a/packages/react-native-compatibility-check/src/ComparisonResult.js +++ b/packages/react-native-compatibility-check/src/ComparisonResult.js @@ -120,7 +120,8 @@ export type UnionMembersComparisonResult = { }>, }; export type MembersComparisonResult = - EnumMembersComparisonResult | UnionMembersComparisonResult; + | EnumMembersComparisonResult + | UnionMembersComparisonResult; export type NullableComparisonResult = { /* Four possible cases of change: void goes to T? :: typeRefined !optionsReduced diff --git a/packages/react-native-compatibility-check/src/DiffResults.js b/packages/react-native-compatibility-check/src/DiffResults.js index 1257c6b0c5b..22f75d196cd 100644 --- a/packages/react-native-compatibility-check/src/DiffResults.js +++ b/packages/react-native-compatibility-check/src/DiffResults.js @@ -87,7 +87,9 @@ type ExportableSchemaDiffers = { }; export type SchemaDiffCategory = 'new' | 'deprecated' | SchemaDiffers; type ExportableSchemaDiffCategory = - 'new' | 'deprecated' | ExportableSchemaDiffers; + | 'new' + | 'deprecated' + | ExportableSchemaDiffers; export type SchemaDiff = { name: string, framework: Framework, diff --git a/packages/react-native/Libraries/Alert/Alert.js b/packages/react-native/Libraries/Alert/Alert.js index 4130ec51143..27108b7f14d 100644 --- a/packages/react-native/Libraries/Alert/Alert.js +++ b/packages/react-native/Libraries/Alert/Alert.js @@ -17,7 +17,10 @@ import {alertWithArgs} from './RCTAlertManager'; * @platform ios */ export type AlertType = - 'default' | 'plain-text' | 'secure-text' | 'login-password'; + | 'default' + | 'plain-text' + | 'secure-text' + | 'login-password'; /** * @platform ios diff --git a/packages/react-native/Libraries/Animated/AnimatedEvent.js b/packages/react-native/Libraries/Animated/AnimatedEvent.js index 866e9bdb20d..3f1245e3fd2 100644 --- a/packages/react-native/Libraries/Animated/AnimatedEvent.js +++ b/packages/react-native/Libraries/Animated/AnimatedEvent.js @@ -21,7 +21,9 @@ import AnimatedValueXY from './nodes/AnimatedValueXY'; import invariant from 'invariant'; export type Mapping = - {[key: string]: Mapping, ...} | AnimatedValue | AnimatedValueXY; + | {[key: string]: Mapping, ...} + | AnimatedValue + | AnimatedValueXY; export type EventConfig = { listener?: ?(NativeSyntheticEvent) => unknown, useNativeDriver: boolean, diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index 922e95ec9f6..b6b3953b429 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -34,19 +34,20 @@ type Builtin = (...ReadonlyArray) => unknown | Date | Error | RegExp; export type WithAnimatedValue = T extends Builtin | Nullable ? T : T extends Primitive - ? | T - | AnimatedNode - | AnimatedAddition - | AnimatedSubtraction - | AnimatedDivision - | AnimatedMultiplication - | AnimatedModulo - | AnimatedDiffClamp - | AnimatedValue - | AnimatedInterpolation - | AnimatedInterpolation - | AnimatedInterpolation - | AnimatedInterpolation + ? + | T + | AnimatedNode + | AnimatedAddition + | AnimatedSubtraction + | AnimatedDivision + | AnimatedMultiplication + | AnimatedModulo + | AnimatedDiffClamp + | AnimatedValue + | AnimatedInterpolation + | AnimatedInterpolation + | AnimatedInterpolation + | AnimatedInterpolation : T extends ReadonlyArray ? ReadonlyArray> : T extends {...} diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index b6a0d4d3b5f..480b3217d04 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -28,7 +28,9 @@ import invariant from 'invariant'; type ExtrapolateType = 'extend' | 'identity' | 'clamp'; export type InterpolationConfigSupportedOutputType = - number | string | NativeColorValue; + | number + | string + | NativeColorValue; export type InterpolationConfigType< OutputT extends InterpolationConfigSupportedOutputType, diff --git a/packages/react-native/Libraries/AppState/AppState.js b/packages/react-native/Libraries/AppState/AppState.js index b46ea05b82e..c8a1506fb67 100644 --- a/packages/react-native/Libraries/AppState/AppState.js +++ b/packages/react-native/Libraries/AppState/AppState.js @@ -29,7 +29,11 @@ import NativeAppState from './NativeAppState'; * @platform ios `inactive` */ export type AppStateStatus = - 'inactive' | 'background' | 'active' | 'extension' | 'unknown'; + | 'inactive' + | 'background' + | 'active' + | 'extension' + | 'unknown'; /** * Events emitted by `AppState`. diff --git a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js index 2d0a98f2601..137233be1df 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -130,7 +130,8 @@ class MessageQueue { } flushedQueue(): - null | [Array, Array, Array, number] { + | null + | [Array, Array, Array, number] { this.__guard(() => { this.__callReactNativeMicrotasks(); }); diff --git a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index b922c77f062..92e5376cb5d 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -43,7 +43,10 @@ type AccessibilityEventDefinitions = { }; type AccessibilityEventTypes = - 'click' | 'focus' | 'viewHoverEnter' | 'windowStateChange'; + | 'click' + | 'focus' + | 'viewHoverEnter' + | 'windowStateChange'; // Mapping of public event names to platform-specific event names. const EventNames: Map = diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index c1bec4b65ed..383f769a401 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -168,7 +168,8 @@ export type ButtonProps = Readonly<{ }>; const NativeTouchable: - typeof TouchableNativeFeedback | typeof TouchableOpacity = + | typeof TouchableNativeFeedback + | typeof TouchableOpacity = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity; export type ButtonInstance = React.ElementRef; diff --git a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js index 40bfa1e121a..da318b73812 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -19,7 +19,11 @@ import NativeKeyboardObserver from './NativeKeyboardObserver'; export type KeyboardEventName = keyof KeyboardEventDefinitions; export type KeyboardEventEasing = - 'easeIn' | 'easeInEaseOut' | 'easeOut' | 'linear' | 'keyboard'; + | 'easeIn' + | 'easeInEaseOut' + | 'easeOut' + | 'linear' + | 'keyboard'; export type KeyboardMetrics = Readonly<{ screenX: number, diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index c0d1a6d62ab..97e72fcdce0 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -142,7 +142,8 @@ type PressableBaseProps = Readonly<{ * the component is currently pressed and returns view styles. */ style?: - ViewStyleProp | ((state: PressableStateCallbackType) => ViewStyleProp), + | ViewStyleProp + | ((state: PressableStateCallbackType) => ViewStyleProp), /** * Identifier used to find this view in tests. diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index 26b01e15f3e..8f218c6e512 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -199,7 +199,8 @@ export type DecelerationRateType = 'fast' | 'normal' | number; export type ScrollResponderType = ScrollViewImperativeMethods; export interface ScrollViewInstance - extends HostInstance, ScrollViewImperativeMethods {} + extends HostInstance, + ScrollViewImperativeMethods {} type InnerViewInstance = React.ElementRef; @@ -393,7 +394,10 @@ export type ScrollViewPropsIOS = Readonly<{ * @platform ios */ contentInsetAdjustmentBehavior?: ?( - 'automatic' | 'scrollableAxes' | 'never' | 'always' + | 'automatic' + | 'scrollableAxes' + | 'never' + | 'always' ), }>; @@ -565,11 +569,9 @@ type ScrollViewBaseProps = Readonly<{ * * @default `'none'` */ - keyboardDismissMode?: ?( - // default - // cross-platform - 'none' | 'on-drag' | 'interactive' - ), // ios only + keyboardDismissMode?: ?// default + // cross-platform + ('none' | 'on-drag' | 'interactive'), // ios only /** * Determines when the keyboard should stay visible after a tap. * diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index 6762a52b334..9cd18a3d2ba 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -32,7 +32,10 @@ export type ScrollViewNativeProps = Readonly<{ centerContent?: ?boolean, contentInset?: ?EdgeInsetsProp, contentInsetAdjustmentBehavior?: ?( - 'automatic' | 'scrollableAxes' | 'never' | 'always' + | 'automatic' + | 'scrollableAxes' + | 'never' + | 'always' ), contentOffset?: ?PointProp, decelerationRate?: ?('fast' | 'normal' | number), diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index eaf81c88d84..cb3b241f808 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -171,20 +171,36 @@ export type KeyboardTypeIOS = export type KeyboardTypeAndroid = 'visible-password'; export type KeyboardTypeOptions = - KeyboardType | KeyboardTypeIOS | KeyboardTypeAndroid; + | KeyboardType + | KeyboardTypeIOS + | KeyboardTypeAndroid; export type InputModeOptions = - 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'; + | 'none' + | 'text' + | 'decimal' + | 'numeric' + | 'tel' + | 'search' + | 'email' + | 'url'; export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send'; export type ReturnKeyTypeIOS = - 'default' | 'emergency-call' | 'google' | 'join' | 'route' | 'yahoo'; + | 'default' + | 'emergency-call' + | 'google' + | 'join' + | 'route' + | 'yahoo'; export type ReturnKeyTypeAndroid = 'none' | 'previous'; export type ReturnKeyTypeOptions = - ReturnKeyType | ReturnKeyTypeIOS | ReturnKeyTypeAndroid; + | ReturnKeyType + | ReturnKeyTypeIOS + | ReturnKeyTypeAndroid; export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; @@ -245,7 +261,9 @@ export type EnterKeyHintTypeIOS = 'enter'; export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send'; export type EnterKeyHintTypeOptions = - EnterKeyHintType | EnterKeyHintTypeAndroid | EnterKeyHintTypeIOS; + | EnterKeyHintType + | EnterKeyHintTypeAndroid + | EnterKeyHintTypeIOS; type PasswordRules = string; @@ -288,7 +306,8 @@ export type TextInputIOSProps = Readonly<{ * @platform ios */ dataDetectorTypes?: - ?DataDetectorTypesType | ReadonlyArray, + | ?DataDetectorTypesType + | ReadonlyArray, /** * If `true`, the keyboard disables the return key when there is no text and @@ -366,7 +385,12 @@ export type TextInputIOSProps = Readonly<{ * @platform ios */ lineBreakModeIOS?: ?( - 'wordWrapping' | 'char' | 'clip' | 'head' | 'middle' | 'tail' + | 'wordWrapping' + | 'char' + | 'clip' + | 'head' + | 'middle' + | 'tail' ), /** @@ -423,7 +447,11 @@ export type TextInputAndroidProps = Readonly<{ * - `yesExcludeDescendants` - this view is important for autofill but its children aren't */ importantForAutofill?: ?( - 'auto' | 'no' | 'noExcludeDescendants' | 'yes' | 'yesExcludeDescendants' + | 'auto' + | 'no' + | 'noExcludeDescendants' + | 'yes' + | 'yesExcludeDescendants' ), /** diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index 5203cf36e87..2854f5e53cc 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -641,54 +641,53 @@ function InternalTextInput(props: TextInputProps): React.Node { ? selectionColor : selectionHandleColor, }; - textInput = - ( - /* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up - * exactly with the props for TextInput. This will need to get fixed */ - /* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't - * match up exactly with the props for TextInput. This will need to get - * fixed */ - /* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't - * match up exactly with the props for TextInput. This will need to get - * fixed */ - - ); + textInput = ( + /* $FlowFixMe[prop-missing] the types for AndroidTextInput don't match up + * exactly with the props for TextInput. This will need to get fixed */ + /* $FlowFixMe[incompatible-type] the types for AndroidTextInput don't + * match up exactly with the props for TextInput. This will need to get + * fixed */ + /* $FlowFixMe[incompatible-type-arg] the types for AndroidTextInput don't + * match up exactly with the props for TextInput. This will need to get + * fixed */ + + ); } return {textInput}; } diff --git a/packages/react-native/Libraries/Components/Touchable/Touchable.js b/packages/react-native/Libraries/Components/Touchable/Touchable.js index 827477f98c5..5804082fd26 100644 --- a/packages/react-native/Libraries/Components/Touchable/Touchable.js +++ b/packages/react-native/Libraries/Components/Touchable/Touchable.js @@ -694,7 +694,7 @@ const TouchableMixinImpl = { curState + '` for Touchable responder `' + typeof this.state.touchable.responderID === - 'number' + 'number' ? this.state.touchable.responderID : 'host component' + '`', ); @@ -707,7 +707,7 @@ const TouchableMixinImpl = { signal + '` for responder `' + typeof this.state.touchable.responderID === - 'number' + 'number' ? this.state.touchable.responderID : '<>' + '`', ); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index e975a0bd385..73f140fa79d 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -84,7 +84,8 @@ export type TouchableNativeFeedbackProps = Readonly<{ | Readonly<{ type: 'ThemeAttrAndroid', attribute: - 'selectableItemBackground' | 'selectableItemBackgroundBorderless', + | 'selectableItemBackground' + | 'selectableItemBackgroundBorderless', rippleRadius: ?number, }> | Readonly<{ diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 3e9b92ad06b..b82a035874e 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -74,7 +74,10 @@ export type TouchableWithoutFeedbackProps = Readonly< */ id?: string, importantForAccessibility?: ?( - 'auto' | 'yes' | 'no' | 'no-hide-descendants' + | 'auto' + | 'yes' + | 'no' + | 'no-hide-descendants' ), nativeID?: ?string, onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown, diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index ed018ab6ad6..32d452656eb 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -62,7 +62,8 @@ export default class NativeEventEmitter< TEventToArgsMap extends Readonly< Record>, > = Readonly>>, -> implements IEventEmitter { +> implements IEventEmitter +{ _nativeModule: ?NativeModule; /** diff --git a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js index c6584d87446..9670253ebb4 100644 --- a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js @@ -20,7 +20,8 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter'; */ export default class NativeEventEmitter< TEventToArgsMap extends Readonly>>, -> implements IEventEmitter { +> implements IEventEmitter +{ addListener( eventType: TEvent, listener: (...args: TEventToArgsMap[TEvent]) => unknown, diff --git a/packages/react-native/Libraries/Image/ImageSource.js b/packages/react-native/Libraries/Image/ImageSource.js index 48c08d25ab0..de099b77c4b 100644 --- a/packages/react-native/Libraries/Image/ImageSource.js +++ b/packages/react-native/Libraries/Image/ImageSource.js @@ -85,7 +85,9 @@ export interface ImageURISource { export type ImageRequireSource = number; export type ImageSource = - ImageRequireSource | ImageURISource | ReadonlyArray; + | ImageRequireSource + | ImageURISource + | ReadonlyArray; type ImageSourceProperties = { body?: ?string, diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 5f3c943e977..e9201f02ff3 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -117,7 +117,10 @@ export type ModalPropsIOS = { * @platform ios */ presentationStyle?: ?( - 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen' + | 'fullScreen' + | 'pageSheet' + | 'formSheet' + | 'overFullScreen' ), /** diff --git a/packages/react-native/Libraries/Network/XMLHttpRequest.js b/packages/react-native/Libraries/Network/XMLHttpRequest.js index 7edb4c2a24c..b125c9e9e7f 100644 --- a/packages/react-native/Libraries/Network/XMLHttpRequest.js +++ b/packages/react-native/Libraries/Network/XMLHttpRequest.js @@ -34,7 +34,12 @@ const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of millisecond export type NativeResponseType = 'base64' | 'blob' | 'text'; export type ResponseType = - '' | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text'; + | '' + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text'; export type Response = ?Object | string; type XHRInterceptor = interface { @@ -653,11 +658,13 @@ class XMLHttpRequest extends EventTarget { } // only call onreadystatechange if there is something to abort, // below logic is per spec - if (!( - this.readyState === this.UNSENT || - (this.readyState === this.OPENED && !this._sent) || - this.readyState === this.DONE - )) { + if ( + !( + this.readyState === this.UNSENT || + (this.readyState === this.OPENED && !this._sent) || + this.readyState === this.DONE + ) + ) { this._reset(); this.setReadyState(this.DONE); } diff --git a/packages/react-native/Libraries/Pressability/HoverState.js b/packages/react-native/Libraries/Pressability/HoverState.js index 7f971a29e87..cfa3f2fd59a 100644 --- a/packages/react-native/Libraries/Pressability/HoverState.js +++ b/packages/react-native/Libraries/Pressability/HoverState.js @@ -19,9 +19,9 @@ let isEnabled = false; if (Platform.OS === 'web') { const canUseDOM = Boolean( typeof window !== 'undefined' && - window.document && - // $FlowFixMe[method-unbinding] - window.document.createElement, + window.document && + // $FlowFixMe[method-unbinding] + window.document.createElement, ); if (canUseDOM) { diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index c04cfe1c4b2..dec894ab912 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -540,7 +540,12 @@ type ____LayoutStyle_Internal = Readonly<{ * for more details. */ alignSelf?: - 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', + | 'auto' + | 'flex-start' + | 'flex-end' + | 'center' + | 'stretch' + | 'baseline', /** `alignContent` controls how rows align in the cross direction, * overriding the `alignContent` of the parent. @@ -731,7 +736,10 @@ type LinearGradientValue = { }; type RadialExtent = - 'closest-corner' | 'closest-side' | 'farthest-corner' | 'farthest-side'; + | 'closest-corner' + | 'closest-side' + | 'farthest-corner' + | 'farthest-side'; export type RadialGradientPosition = | { top: number | string, @@ -777,7 +785,10 @@ export type BackgroundSizeValue = { }; export type BackgroundRepeatKeyword = - 'repeat' | 'space' | 'round' | 'no-repeat'; + | 'repeat' + | 'space' + | 'round' + | 'no-repeat'; export type BackgroundPositionValue = | { @@ -895,7 +906,8 @@ export type ____ViewStyle_InternalBase = Readonly<{ experimental_backgroundImage?: ReadonlyArray | string, experimental_backgroundSize?: ReadonlyArray | string, experimental_backgroundPosition?: - ReadonlyArray | string, + | ReadonlyArray + | string, experimental_backgroundRepeat?: ReadonlyArray | string, isolation?: 'auto' | 'isolate', }>; @@ -1020,11 +1032,20 @@ type ____TextStyle_InternalBase = Readonly<{ letterSpacing?: number, lineHeight?: number, textAlign?: - 'auto' | 'left' | 'right' | 'center' | 'justify' | 'start' | 'end', + | 'auto' + | 'left' + | 'right' + | 'center' + | 'justify' + | 'start' + | 'end', textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center', includeFontPadding?: boolean, textDecorationLine?: - 'none' | 'underline' | 'line-through' | 'underline line-through', + | 'none' + | 'underline' + | 'line-through' + | 'underline line-through', textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy', textDecorationColor?: ____ColorValue_Internal, textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase', @@ -1072,7 +1093,12 @@ export type ____DangerouslyImpreciseStyle_Internal = Readonly<{ }>; export type StyleProp = - null | void | T | false | '' | ReadonlyArray>; + | null + | void + | T + | false + | '' + | ReadonlyArray>; export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp< Partial<____DangerouslyImpreciseStyle_Internal>, diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index 0c2abd7faa0..b46421463c3 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -74,7 +74,8 @@ export type ____TransformStyle_Internal = Readonly<{ // TODO: what is the actual type it expects? | { readonly matrix: - ReadonlyArray | AnimatedNode, + | ReadonlyArray + | AnimatedNode, }, >, >, @@ -93,5 +94,6 @@ export type ____TransformStyle_Internal = Readonly<{ * E.g. transformOrigin: '30% 80% 15px' */ transformOrigin?: - [string | number, string | number, string | number] | string, + | [string | number, string | number, string | number] + | string, }>; diff --git a/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js b/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js index f733c96c964..36f67b2217c 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js @@ -39,7 +39,8 @@ const LINEAR_GRADIENT_DEFAULT_DIRECTION: LinearGradientDirection = { }; type LinearGradientDirection = - {type: 'angle', value: number} | {type: 'keyword', value: string}; + | {type: 'angle', value: number} + | {type: 'keyword', value: string}; type LinearGradientBackgroundImage = { type: 'linear-gradient', @@ -76,7 +77,8 @@ type ColorStopColor = ProcessedColorValue | null; type ColorStopPosition = number | string | null; type ParsedBackgroundImageValue = - LinearGradientBackgroundImage | RadialGradientBackgroundImage; + | LinearGradientBackgroundImage + | RadialGradientBackgroundImage; export default function processBackgroundImage( backgroundImage: ?(ReadonlyArray | string), diff --git a/packages/react-native/Libraries/Utilities/PlatformTypes.js b/packages/react-native/Libraries/Utilities/PlatformTypes.js index 24c9aac7302..5a65087c079 100644 --- a/packages/react-native/Libraries/Utilities/PlatformTypes.js +++ b/packages/react-native/Libraries/Utilities/PlatformTypes.js @@ -9,7 +9,12 @@ */ export type PlatformOSType = - 'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native'; + | 'ios' + | 'android' + | 'macos' + | 'windows' + | 'web' + | 'native'; type OptionalPlatformSelectSpec = { [key in PlatformOSType]?: T, // eslint-disable-line no-unused-vars @@ -254,4 +259,8 @@ type WebPlatform = { }; export type PlatformType = - IOSPlatform | AndroidPlatform | WindowsPlatform | MacOSPlatform | WebPlatform; + | IOSPlatform + | AndroidPlatform + | WindowsPlatform + | MacOSPlatform + | WebPlatform; diff --git a/packages/react-native/Libraries/Utilities/useWindowDimensions.js b/packages/react-native/Libraries/Utilities/useWindowDimensions.js index 48c68911615..1b04aeb0ad4 100644 --- a/packages/react-native/Libraries/Utilities/useWindowDimensions.js +++ b/packages/react-native/Libraries/Utilities/useWindowDimensions.js @@ -22,7 +22,8 @@ import {useEffect, useState} from 'react'; * @see https://reactnative.dev/docs/usewindowdimensions */ export default function useWindowDimensions(): - DisplayMetrics | DisplayMetricsAndroid { + | DisplayMetrics + | DisplayMetricsAndroid { const [dimensions, setDimensions] = useState(() => Dimensions.get('window')); useEffect(() => { function handleChange({ diff --git a/packages/react-native/flow/bom.js.flow b/packages/react-native/flow/bom.js.flow index a7045edfb50..64fd2d2b1a6 100644 --- a/packages/react-native/flow/bom.js.flow +++ b/packages/react-native/flow/bom.js.flow @@ -81,6 +81,7 @@ declare var console: { // Stack tagging createTask(label: string): ConsoleTask, + ... }; @@ -514,7 +515,9 @@ declare class XMLHttpRequestEventTarget extends EventTarget { // this part of spec is not finished yet, apparently // https://stackoverflow.com/questions/35296664/can-fetch-get-object-as-headers type HeadersInit = - Headers | Array<[string, string]> | {[key: string]: string, ...}; + | Headers + | Array<[string, string]> + | {[key: string]: string, ...}; // TODO Heades and URLSearchParams are almost the same thing. // Could it somehow be abstracted away? @@ -596,7 +599,12 @@ type ReferrerPolicyType = | 'unsafe-url'; type ResponseType = - 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; + | 'basic' + | 'cors' + | 'default' + | 'error' + | 'opaque' + | 'opaqueredirect'; type BodyInit = | string diff --git a/packages/react-native/flow/cssom.js.flow b/packages/react-native/flow/cssom.js.flow index 6633fbecf44..50bd5c15dea 100644 --- a/packages/react-native/flow/cssom.js.flow +++ b/packages/react-native/flow/cssom.js.flow @@ -409,7 +409,10 @@ type AnimationPlayState = 'idle' | 'running' | 'paused' | 'finished'; type AnimationReplaceState = 'active' | 'removed' | 'persisted'; type FillMode = 'none' | 'forwards' | 'backwards' | 'both' | 'auto'; type PlaybackDirection = - 'normal' | 'reverse' | 'alternate' | 'alternate-reverse'; + | 'normal' + | 'reverse' + | 'alternate' + | 'alternate-reverse'; type IterationCompositeOperation = 'replace' | 'accumulate'; type CompositeOperation = 'replace' | 'add' | 'accumulate'; type CompositeOperationOrAuto = CompositeOperation | 'auto'; @@ -478,7 +481,12 @@ type PropertyIndexedKeyframes = { easing?: string | string[], offset?: number | (number | null)[], [property: string]: - string | string[] | number | null | (number | null)[] | void, + | string + | string[] + | number + | null + | (number | null)[] + | void, ... }; diff --git a/packages/react-native/flow/dom.js.flow b/packages/react-native/flow/dom.js.flow index 038a6f01493..55e96b385eb 100644 --- a/packages/react-native/flow/dom.js.flow +++ b/packages/react-native/flow/dom.js.flow @@ -172,52 +172,68 @@ type EventHandler = (event: Event) => unknown; type EventListener = {handleEvent: EventHandler, ...} | EventHandler; type MouseEventHandler = (event: MouseEvent) => unknown; type MouseEventListener = - {handleEvent: MouseEventHandler, ...} | MouseEventHandler; + | {handleEvent: MouseEventHandler, ...} + | MouseEventHandler; type FocusEventHandler = (event: FocusEvent) => unknown; type FocusEventListener = - {handleEvent: FocusEventHandler, ...} | FocusEventHandler; + | {handleEvent: FocusEventHandler, ...} + | FocusEventHandler; type KeyboardEventHandler = (event: KeyboardEvent) => unknown; type KeyboardEventListener = - {handleEvent: KeyboardEventHandler, ...} | KeyboardEventHandler; + | {handleEvent: KeyboardEventHandler, ...} + | KeyboardEventHandler; type InputEventHandler = (event: InputEvent) => unknown; type InputEventListener = - {handleEvent: InputEventHandler, ...} | InputEventHandler; + | {handleEvent: InputEventHandler, ...} + | InputEventHandler; type TouchEventHandler = (event: TouchEvent) => unknown; type TouchEventListener = - {handleEvent: TouchEventHandler, ...} | TouchEventHandler; + | {handleEvent: TouchEventHandler, ...} + | TouchEventHandler; type WheelEventHandler = (event: WheelEvent) => unknown; type WheelEventListener = - {handleEvent: WheelEventHandler, ...} | WheelEventHandler; + | {handleEvent: WheelEventHandler, ...} + | WheelEventHandler; type AbortProgressEventHandler = (event: ProgressEvent) => unknown; type AbortProgressEventListener = - {handleEvent: AbortProgressEventHandler, ...} | AbortProgressEventHandler; + | {handleEvent: AbortProgressEventHandler, ...} + | AbortProgressEventHandler; type ProgressEventHandler = (event: ProgressEvent) => unknown; type ProgressEventListener = - {handleEvent: ProgressEventHandler, ...} | ProgressEventHandler; + | {handleEvent: ProgressEventHandler, ...} + | ProgressEventHandler; type DragEventHandler = (event: DragEvent) => unknown; type DragEventListener = - {handleEvent: DragEventHandler, ...} | DragEventHandler; + | {handleEvent: DragEventHandler, ...} + | DragEventHandler; type PointerEventHandler = (event: PointerEvent) => unknown; type PointerEventListener = - {handleEvent: PointerEventHandler, ...} | PointerEventHandler; + | {handleEvent: PointerEventHandler, ...} + | PointerEventHandler; type AnimationEventHandler = (event: AnimationEvent) => unknown; type AnimationEventListener = - {handleEvent: AnimationEventHandler, ...} | AnimationEventHandler; + | {handleEvent: AnimationEventHandler, ...} + | AnimationEventHandler; type ClipboardEventHandler = (event: ClipboardEvent) => unknown; type ClipboardEventListener = - {handleEvent: ClipboardEventHandler, ...} | ClipboardEventHandler; + | {handleEvent: ClipboardEventHandler, ...} + | ClipboardEventHandler; type TransitionEventHandler = (event: TransitionEvent) => unknown; type TransitionEventListener = - {handleEvent: TransitionEventHandler, ...} | TransitionEventHandler; + | {handleEvent: TransitionEventHandler, ...} + | TransitionEventHandler; type MessageEventHandler = (event: MessageEvent) => unknown; type MessageEventListener = - {handleEvent: MessageEventHandler, ...} | MessageEventHandler; + | {handleEvent: MessageEventHandler, ...} + | MessageEventHandler; type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => unknown; type BeforeUnloadEventListener = - {handleEvent: BeforeUnloadEventHandler, ...} | BeforeUnloadEventHandler; + | {handleEvent: BeforeUnloadEventHandler, ...} + | BeforeUnloadEventHandler; type StorageEventHandler = (event: StorageEvent) => unknown; type StorageEventListener = - {handleEvent: StorageEventHandler, ...} | StorageEventHandler; + | {handleEvent: StorageEventHandler, ...} + | StorageEventHandler; type SecurityPolicyViolationEventHandler = ( event: SecurityPolicyViolationEvent, ) => unknown; @@ -226,7 +242,8 @@ type SecurityPolicyViolationEventListener = | SecurityPolicyViolationEventHandler; type USBConnectionEventHandler = (event: USBConnectionEvent) => unknown; type USBConnectionEventListener = - {handleEvent: USBConnectionEventHandler, ...} | USBConnectionEventHandler; + | {handleEvent: USBConnectionEventHandler, ...} + | USBConnectionEventHandler; type MediaKeySessionType = 'temporary' | 'persistent-license'; type MediaKeyStatus = @@ -255,7 +272,13 @@ type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel'; type WheelEventTypes = 'wheel'; type AbortProgressEventTypes = 'abort'; type ProgressEventTypes = - 'abort' | 'error' | 'load' | 'loadend' | 'loadstart' | 'progress' | 'timeout'; + | 'abort' + | 'error' + | 'load' + | 'loadend' + | 'loadstart' + | 'progress' + | 'timeout'; type DragEventTypes = | 'drag' | 'dragend' @@ -277,10 +300,15 @@ type PointerEventTypes = | 'gotpointercapture' | 'lostpointercapture'; type AnimationEventTypes = - 'animationstart' | 'animationend' | 'animationiteration'; + | 'animationstart' + | 'animationend' + | 'animationiteration'; type ClipboardEventTypes = 'clipboardchange' | 'cut' | 'copy' | 'paste'; type TransitionEventTypes = - 'transitionrun' | 'transitionstart' | 'transitionend' | 'transitioncancel'; + | 'transitionrun' + | 'transitionstart' + | 'transitionend' + | 'transitioncancel'; type MessageEventTypes = string; type BeforeUnloadEventTypes = 'beforeunload'; type StorageEventTypes = 'storage'; @@ -6023,7 +6051,8 @@ type NodeFilterCallback = ( | typeof NodeFilter.FILTER_SKIP; type NodeFilterInterface = - NodeFilterCallback | {acceptNode: NodeFilterCallback, ...}; + | NodeFilterCallback + | {acceptNode: NodeFilterCallback, ...}; // TODO: window.NodeFilter exists at runtime and behaves as a constructor // as far as `instanceof` is concerned, but it is not callable. diff --git a/packages/react-native/scripts/compose-source-maps.js b/packages/react-native/scripts/compose-source-maps.js index 42a67b762c3..dd1c39999b1 100755 --- a/packages/react-native/scripts/compose-source-maps.js +++ b/packages/react-native/scripts/compose-source-maps.js @@ -16,7 +16,7 @@ const {composeSourceMaps} = require('metro-source-map'); const argv = process.argv.slice(2); let outputPath; -for (let i = 0; i < argv.length;) { +for (let i = 0; i < argv.length; ) { if (argv[i] === '-o') { outputPath = argv[i + 1]; argv.splice(i, 2); diff --git a/packages/react-native/scripts/featureflags/types.js b/packages/react-native/scripts/featureflags/types.js index acec7193a8a..086d3f9bbe0 100644 --- a/packages/react-native/scripts/featureflags/types.js +++ b/packages/react-native/scripts/featureflags/types.js @@ -23,7 +23,10 @@ export type FeatureFlagDefinitions = Readonly<{ * - stable: the value of the feature flag will be `expectedReleaseValue` on all releases. */ export type OSSReleaseStageValue = - 'none' | 'experimental' | 'canary' | 'stable'; + | 'none' + | 'experimental' + | 'canary' + | 'stable'; export type CommonFeatureFlagConfig< TValue extends FeatureFlagValue = FeatureFlagValue, diff --git a/packages/react-native/src/private/viewtransition/specs/NativeViewTransition.js b/packages/react-native/src/private/viewtransition/specs/NativeViewTransition.js index 76b13411730..52817be7732 100644 --- a/packages/react-native/src/private/viewtransition/specs/NativeViewTransition.js +++ b/packages/react-native/src/private/viewtransition/specs/NativeViewTransition.js @@ -25,7 +25,7 @@ export interface Spec extends TurboModule { }; readonly findPseudoElementShadowNodeByTag: ( reactTag: number, - ) => ?unknown; /* Node */ + ) => ?unknown /* Node */; readonly waitForTransitionAnimation: (animationId: number) => void; readonly transitionAnimationFinished: (animationId: number) => void; } diff --git a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js index 5253243ef67..12a34399221 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js +++ b/packages/react-native/src/private/webapis/dom/nodes/specs/NativeDOM.js @@ -19,7 +19,9 @@ export opaque type NativeElementReference = ShadowNode; export opaque type NativeTextReference = ShadowNode; export type NativeNodeReference = - NativeElementReference | NativeTextReference | RootTag; + | NativeElementReference + | NativeTextReference + | RootTag; export type MeasureInWindowOnSuccessCallback = ( x: number, @@ -56,16 +58,16 @@ export interface Spec extends TurboModule { readonly getChildNodes: ( nativeNodeReference: unknown /* NativeNodeReference */, - ) => ReadonlyArray; /* $ReadOnlyArray */ + ) => ReadonlyArray /* $ReadOnlyArray */; readonly getElementById?: ( nativeNodeReference: unknown /* NativeNodeReference */, id: string, - ) => unknown; /* ?InstanceHandle */ + ) => unknown /* ?InstanceHandle */; readonly getParentNode: ( nativeNodeReference: unknown /* NativeNodeReference */, - ) => unknown; /* ?InstanceHandle */ + ) => unknown /* ?InstanceHandle */; readonly isConnected: ( nativeNodeReference: unknown /* NativeNodeReference */, @@ -77,24 +79,24 @@ export interface Spec extends TurboModule { readonly getBorderWidth: ( nativeElementReference: unknown /* NativeElementReference */, - ) => ReadonlyArray; /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */ + ) => ReadonlyArray /* [topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number] */; readonly getBoundingClientRect: ( nativeElementReference: unknown /* NativeElementReference */, includeTransform: boolean, - ) => ReadonlyArray; /* [x: number, y: number, width: number, height: number] */ + ) => ReadonlyArray /* [x: number, y: number, width: number, height: number] */; readonly getInnerSize: ( nativeElementReference: unknown /* NativeElementReference */, - ) => ReadonlyArray; /* [width: number, height: number] */ + ) => ReadonlyArray /* [width: number, height: number] */; readonly getScrollPosition: ( nativeElementReference: unknown /* NativeElementReference */, - ) => ReadonlyArray; /* [scrollLeft: number, scrollTop: number] */ + ) => ReadonlyArray /* [scrollLeft: number, scrollTop: number] */; readonly getScrollSize: ( nativeElementReference: unknown /* NativeElementReference */, - ) => ReadonlyArray; /* [scrollWidth: number, scrollHeight: number] */ + ) => ReadonlyArray /* [scrollWidth: number, scrollHeight: number] */; readonly getTagName: ( nativeElementReference: unknown /* NativeElementReference */, @@ -125,7 +127,7 @@ export interface Spec extends TurboModule { readonly getOffset: ( nativeElementReference: unknown /* NativeElementReference */, - ) => ReadonlyArray; /* [offsetParent: ?InstanceHandle, top: number, left: number] */ + ) => ReadonlyArray /* [offsetParent: ?InstanceHandle, top: number, left: number] */; /* * Special methods to handle the root node. @@ -134,7 +136,7 @@ export interface Spec extends TurboModule { readonly linkRootNode?: ( rootTag: number /* RootTag */, instanceHandle: unknown /* InstanceHandle */, - ) => unknown; /* ?NativeElementReference */ + ) => unknown /* ?NativeElementReference */; /** * Legacy layout APIs (for `ReactNativeElement`). diff --git a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js index ac6eda8c618..7440f670a96 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js @@ -38,12 +38,14 @@ export function expectRectEquals( expected: {x: number, y: number, width: number, height: number}, ): boolean { const {x, y, width, height} = expected; - if (!( - rect.x === x && - rect.y === y && - rect.width === width && - rect.height === height - )) { + if ( + !( + rect.x === x && + rect.y === y && + rect.width === width && + rect.height === height + ) + ) { const received = { x: rect.x, y: rect.y, diff --git a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js index aef916f4e7f..9e4fa32fe45 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js @@ -14,7 +14,11 @@ import {setPlatformObject} from '../webidl/PlatformObjects'; export type DOMHighResTimeStamp = number; export type PerformanceEntryType = - 'mark' | 'measure' | 'event' | 'longtask' | 'resource'; + | 'mark' + | 'measure' + | 'event' + | 'longtask' + | 'resource'; export type PerformanceEntryJSON = { name: string, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js index 45af579fcd7..de5ee16441f 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js @@ -25,7 +25,8 @@ export type FailingPlatformTestAssertionResult = Readonly<{ }>; export type PlatformTestAssertionResult = - PassingPlatformTestAssertionResult | FailingPlatformTestAssertionResult; + | PassingPlatformTestAssertionResult + | FailingPlatformTestAssertionResult; export type PlatformTestResultStatus = 'PASS' | 'FAIL' | 'ERROR' | 'SKIPPED'; diff --git a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js index 9bf56b7f6a1..4ee3377ff31 100644 --- a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js +++ b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js @@ -49,7 +49,8 @@ const TextInputForm = () => { const CloseButton = ( props: - {behavior: any, setModalOpen: any} | {behavior: string, setModalOpen: any}, + | {behavior: any, setModalOpen: any} + | {behavior: string, setModalOpen: any}, ) => { return ( = first && - first >= 0 && - last < itemCount && - first >= overscanFirst && - last <= overscanLast && - first <= visible.first && - last >= visible.last - )) { + if ( + !( + last >= first && + first >= 0 && + last < itemCount && + first >= overscanFirst && + last <= overscanLast && + first <= visible.first && + last >= visible.last + ) + ) { throw new Error( 'Bad window calculation ' + JSON.stringify({ diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index a8593403e4c..298331a0b83 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -1973,9 +1973,9 @@ class VirtualizedList extends StateSafePureComponent< // Keep a viewport's worth of content around the last focused cell to allow // random navigation around it without any blanking. E.g. tabbing from one // focused item out of viewport to another. - if (!( - this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey] - )) { + if ( + !(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey]) + ) { return []; } diff --git a/packages/virtualized-lists/Lists/VirtualizedSectionList.js b/packages/virtualized-lists/Lists/VirtualizedSectionList.js index b9551b65542..55a63f8866f 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -131,8 +131,10 @@ type State = {childProps: VirtualizedListProps, ...}; */ class VirtualizedSectionList< ItemT, - SectionT extends SectionBase = + SectionT extends SectionBase< + ItemT, DefaultVirtualizedSectionT, + > = DefaultVirtualizedSectionT, > extends React.PureComponent< VirtualizedSectionListProps, State, @@ -641,8 +643,10 @@ function ItemWithSeparator( const VirtualizedSectionListComponent = VirtualizedSectionList as component< ItemT, - SectionT extends SectionBase = + SectionT extends SectionBase< + ItemT, DefaultVirtualizedSectionT, + > = DefaultVirtualizedSectionT, >( ref?: React.RefSetter< interface { diff --git a/private/react-native-fantom/src/Benchmark.js b/private/react-native-fantom/src/Benchmark.js index f564d7f8e8e..37a8b297ff7 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -61,7 +61,8 @@ type SuiteResults = Array>; type TestWithArgName = string | ((testArg: TestArgType) => string); type TestWithArgOptions = - FnOptions | ((testArg: TestArgType) => FnOptions); + | FnOptions + | ((testArg: TestArgType) => FnOptions); interface ParameterizedTestFunction { (