diff --git a/.prettierrc.js b/.prettierrc.js index dca775b07037..70a05cba5f46 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -7,11 +7,6 @@ * @format */ -let plugins = ['prettier-plugin-hermes-parser']; -try { - plugins = require('./.prettier-plugins.fb.js'); -} catch {} - module.exports = { arrowParens: 'avoid', bracketSameLine: true, @@ -20,7 +15,6 @@ module.exports = { singleQuote: true, trailingComma: 'all', endOfLine: 'lf', - plugins, overrides: [ { files: ['*.code-workspace'], @@ -31,7 +25,7 @@ module.exports = { { files: ['*.js', '*.js.flow'], options: { - parser: 'hermes', + parser: 'flow', }, }, { diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 1a99ec0dcbd2..c92ff006df23 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -457,8 +457,7 @@ 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; @@ -578,8 +577,7 @@ 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, @@ -928,14 +926,7 @@ 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'; @@ -2560,9 +2551,9 @@ declare class http$Agent<+SocketT = net$Socket> { sockets: {[name: string]: ReadonlyArray, ...}; } -declare class http$IncomingMessage - extends stream$Readable -{ +declare class http$IncomingMessage< + SocketT = net$Socket, +> extends stream$Readable { headers: Object; rawHeaders: Array; httpVersion: string; @@ -2578,9 +2569,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; @@ -2878,10 +2869,7 @@ 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; @@ -3211,9 +3199,9 @@ declare module 'perf_hooks' { +detail?: T; } - declare export class PerformanceMeasure - extends PerformanceEntry - { + declare export class PerformanceMeasure< + T = unknown, + > extends PerformanceEntry { +entryType: 'measure'; +detail?: T; } @@ -3398,11 +3386,7 @@ 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, @@ -5565,9 +5549,7 @@ 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 e28bb4921fed..d3b6cd034c47 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -246,12 +246,7 @@ 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: { @@ -435,13 +430,7 @@ 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; @@ -1446,8 +1435,7 @@ 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 abba5ac2cb69..f58af46605e8 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -1293,8 +1293,7 @@ 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 1f18ac9da056..d98bd1ed5335 100644 --- a/flow-typed/npm/commander_v12.x.x.js +++ b/flow-typed/npm/commander_v12.x.x.js @@ -15,8 +15,7 @@ declare module 'commander' { declare type LiteralUnion = - | LiteralType - | {...BaseType, ...{[key: empty]: empty, ...}}; + LiteralType | {...BaseType, ...{[key: empty]: empty, ...}}; declare export class CommanderError mixins Error { code: string; @@ -335,10 +334,7 @@ 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 38c859aca693..86e3cfc25f1d 100644 --- a/flow-typed/npm/electron-packager_v20.x.x.js +++ b/flow-typed/npm/electron-packager_v20.x.x.js @@ -49,21 +49,14 @@ 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 c54a07291e94..a3a8dae8b4c3 100644 --- a/flow-typed/npm/execa_v5.x.x.js +++ b/flow-typed/npm/execa_v5.x.x.js @@ -13,12 +13,7 @@ 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, @@ -74,8 +69,7 @@ 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 00767deaa1c8..70597548c96c 100644 --- a/flow-typed/npm/jest.js +++ b/flow-typed/npm/jest.js @@ -214,10 +214,7 @@ 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 51eadf91b48a..c8b47b6404ef 100644 --- a/flow-typed/npm/jsonc-parser_v2.2.x.js +++ b/flow-typed/npm/jsonc-parser_v2.2.x.js @@ -155,13 +155,7 @@ 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 5b6b9cc51b46..22108efa6b74 100644 --- a/flow-typed/npm/node-fetch_v2.x.x.js +++ b/flow-typed/npm/node-fetch_v2.x.x.js @@ -157,12 +157,7 @@ declare module 'node-fetch' { } declare type ResponseType = - | 'basic' - | 'cors' - | 'default' - | 'error' - | 'opaque' - | 'opaqueredirect'; + 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; declare interface ResponseInit { headers?: HeaderInit; @@ -172,12 +167,7 @@ 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 a13951717f0f..fbcdfda1f5e2 100644 --- a/flow-typed/npm/pretty-format_v29.x.x.js +++ b/flow-typed/npm/pretty-format_v29.x.x.js @@ -37,9 +37,7 @@ 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 a4326724e3ee..dfb0557cd726 100644 --- a/flow-typed/npm/rxjs_v6.x.x.js +++ b/flow-typed/npm/rxjs_v6.x.x.js @@ -9,11 +9,14 @@ declare interface rxjs$UnaryFunction { (source: T): R; } -declare interface rxjs$OperatorFunction - extends rxjs$UnaryFunction, rxjs$Observable> {} +declare interface rxjs$OperatorFunction extends rxjs$UnaryFunction< + rxjs$Observable, + rxjs$Observable, +> {} declare type rxjs$FactoryOrValue = T | (() => T); -declare interface rxjs$MonoTypeOperatorFunction - extends rxjs$OperatorFunction {} +declare interface rxjs$MonoTypeOperatorFunction< + T, +> extends rxjs$OperatorFunction {} declare interface rxjs$Timestamp { value: T; timestamp: number; @@ -47,9 +50,7 @@ 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, @@ -588,8 +589,7 @@ 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,9 +630,7 @@ declare module 'rxjs' { ) => rxjs$Observable) & (( ...observables: ( - | rxjs$ObservableInput - | rxjs$SchedulerLike - | number + rxjs$ObservableInput | rxjs$SchedulerLike | number )[] ) => rxjs$Observable) & (( @@ -3349,9 +3347,7 @@ 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 c5ffdee80618..22eb29608ca5 100644 --- a/flow-typed/npm/shelljs_v0.x.x.js +++ b/flow-typed/npm/shelljs_v0.x.x.js @@ -48,14 +48,7 @@ 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 2b6bbba9bafa..821e79e0a969 100644 --- a/flow-typed/npm/tinybench_v4.1.x.js +++ b/flow-typed/npm/tinybench_v4.1.x.js @@ -101,9 +101,7 @@ 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 056c07f76f0a..b2a054a622c3 100644 --- a/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js +++ b/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js @@ -21,10 +21,7 @@ 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 89838f2d11d0..707d19ed3bbe 100644 --- a/packages/dev-middleware/src/inspector-proxy/types.js +++ b/packages/dev-middleware/src/inspector-proxy/types.js @@ -107,16 +107,11 @@ 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 b154aabcbe53..2de452899cd6 100644 --- a/packages/eslint-plugin-react-native/platform-colors.js +++ b/packages/eslint-plugin-react-native/platform-colors.js @@ -58,14 +58,12 @@ 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 78e6e11559ca..5983f10dc832 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -91,22 +91,18 @@ 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 bfe131904a21..fc99494c37d8 100644 --- a/packages/jest-preset/jest-preset.js +++ b/packages/jest-preset/jest-preset.js @@ -28,9 +28,8 @@ 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 74fc4053c2b7..2f4e44c187bc 100644 --- a/packages/metro-config/src/index.flow.js +++ b/packages/metro-config/src/index.flow.js @@ -85,12 +85,10 @@ 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 41b8edabf542..1c383704fd72 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -270,8 +270,7 @@ export type ReservedTypeAnnotation = Readonly<{ * NativeModule Types */ export type Nullable = - | NullableTypeAnnotation - | T; + NullableTypeAnnotation | T; export type NullableTypeAnnotation = Readonly<{ @@ -345,8 +344,7 @@ export type NativeModuleEnumMember = { }; export type NativeModuleEnumMemberType = - | 'NumberTypeAnnotation' - | 'StringTypeAnnotation'; + 'NumberTypeAnnotation' | 'StringTypeAnnotation'; export type NativeModuleEnumDeclaration = Readonly<{ name: string, @@ -436,12 +434,10 @@ export type NativeModuleBaseTypeAnnotation = | NativeModuleMixedTypeAnnotation; export type NativeModuleParamTypeAnnotation = - | NativeModuleBaseTypeAnnotation - | NativeModuleParamOnlyTypeAnnotation; + NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation; export type NativeModuleReturnTypeAnnotation = - | NativeModuleBaseTypeAnnotation - | NativeModuleReturnOnlyTypeAnnotation; + NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation; export type NativeModuleTypeAnnotation = | NativeModuleBaseTypeAnnotation @@ -452,8 +448,7 @@ 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 8800427a6157..381fef3c88dd 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -49,14 +49,12 @@ 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 f51d7ccede32..f097b2b9314b 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -33,15 +33,13 @@ 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 23d16906883b..407327d24c17 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -354,8 +354,7 @@ 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 @@ -364,8 +363,7 @@ 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 851450b0b181..3ddb518fbc38 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -177,22 +177,18 @@ 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 40b4d9343953..967206eaef61 100644 --- a/packages/react-native-compatibility-check/src/ComparisonResult.js +++ b/packages/react-native-compatibility-check/src/ComparisonResult.js @@ -120,8 +120,7 @@ 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 22f75d196cdf..1257c6b0c5b0 100644 --- a/packages/react-native-compatibility-check/src/DiffResults.js +++ b/packages/react-native-compatibility-check/src/DiffResults.js @@ -87,9 +87,7 @@ 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 27108b7f14d3..4130ec511438 100644 --- a/packages/react-native/Libraries/Alert/Alert.js +++ b/packages/react-native/Libraries/Alert/Alert.js @@ -17,10 +17,7 @@ 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 3f1245e3fd27..866e9bdb20d7 100644 --- a/packages/react-native/Libraries/Animated/AnimatedEvent.js +++ b/packages/react-native/Libraries/Animated/AnimatedEvent.js @@ -21,9 +21,7 @@ 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 b6b3953b429d..922e95ec9f6c 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -34,20 +34,19 @@ 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 480b3217d04b..b6a0d4d3b5f5 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -28,9 +28,7 @@ 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 c8a1506fb674..b46ea05b82e0 100644 --- a/packages/react-native/Libraries/AppState/AppState.js +++ b/packages/react-native/Libraries/AppState/AppState.js @@ -29,11 +29,7 @@ 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 137233be1dfa..2d0a98f26010 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -130,8 +130,7 @@ 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 92e5376cb5d1..b922c77f0626 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -43,10 +43,7 @@ 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 383f769a4018..c1bec4b65edf 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -168,8 +168,7 @@ 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 da318b738124..40bfa1e121ac 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -19,11 +19,7 @@ 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 97e72fcdce0e..c0d1a6d62ab3 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -142,8 +142,7 @@ 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 8f218c6e5120..26b01e15f3eb 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -199,8 +199,7 @@ export type DecelerationRateType = 'fast' | 'normal' | number; export type ScrollResponderType = ScrollViewImperativeMethods; export interface ScrollViewInstance - extends HostInstance, - ScrollViewImperativeMethods {} + extends HostInstance, ScrollViewImperativeMethods {} type InnerViewInstance = React.ElementRef; @@ -394,10 +393,7 @@ export type ScrollViewPropsIOS = Readonly<{ * @platform ios */ contentInsetAdjustmentBehavior?: ?( - | 'automatic' - | 'scrollableAxes' - | 'never' - | 'always' + 'automatic' | 'scrollableAxes' | 'never' | 'always' ), }>; @@ -569,9 +565,11 @@ 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 9cd18a3d2bac..6762a52b3345 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -32,10 +32,7 @@ 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 cb3b241f8089..eaf81c88d84b 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -171,36 +171,20 @@ 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'; @@ -261,9 +245,7 @@ export type EnterKeyHintTypeIOS = 'enter'; export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send'; export type EnterKeyHintTypeOptions = - | EnterKeyHintType - | EnterKeyHintTypeAndroid - | EnterKeyHintTypeIOS; + EnterKeyHintType | EnterKeyHintTypeAndroid | EnterKeyHintTypeIOS; type PasswordRules = string; @@ -306,8 +288,7 @@ 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 @@ -385,12 +366,7 @@ export type TextInputIOSProps = Readonly<{ * @platform ios */ lineBreakModeIOS?: ?( - | 'wordWrapping' - | 'char' - | 'clip' - | 'head' - | 'middle' - | 'tail' + 'wordWrapping' | 'char' | 'clip' | 'head' | 'middle' | 'tail' ), /** @@ -447,11 +423,7 @@ 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 2854f5e53cc0..5203cf36e873 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -641,53 +641,54 @@ 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 5804082fd26b..827477f98c5b 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 73f140fa79d9..e975a0bd3858 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -84,8 +84,7 @@ 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 b82a035874ec..3e9b92ad06b1 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -74,10 +74,7 @@ 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 32d452656eb7..ed018ab6ad63 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -62,8 +62,7 @@ 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 9670253ebb44..c6584d87446c 100644 --- a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js @@ -20,8 +20,7 @@ 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 de099b77c4b3..48c08d25ab0b 100644 --- a/packages/react-native/Libraries/Image/ImageSource.js +++ b/packages/react-native/Libraries/Image/ImageSource.js @@ -85,9 +85,7 @@ 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 e9201f02ff3f..5f3c943e9776 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -117,10 +117,7 @@ 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 b125c9e9e7fa..7edb4c2a24c5 100644 --- a/packages/react-native/Libraries/Network/XMLHttpRequest.js +++ b/packages/react-native/Libraries/Network/XMLHttpRequest.js @@ -34,12 +34,7 @@ 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 { @@ -658,13 +653,11 @@ 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 cfa3f2fd59a8..7f971a29e872 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 dec894ab9129..c04cfe1c4b20 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -540,12 +540,7 @@ 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. @@ -736,10 +731,7 @@ 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, @@ -785,10 +777,7 @@ export type BackgroundSizeValue = { }; export type BackgroundRepeatKeyword = - | 'repeat' - | 'space' - | 'round' - | 'no-repeat'; + 'repeat' | 'space' | 'round' | 'no-repeat'; export type BackgroundPositionValue = | { @@ -906,8 +895,7 @@ 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', }>; @@ -1032,20 +1020,11 @@ 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', @@ -1093,12 +1072,7 @@ 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 b46421463c3a..0c2abd7faa0a 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -74,8 +74,7 @@ export type ____TransformStyle_Internal = Readonly<{ // TODO: what is the actual type it expects? | { readonly matrix: - | ReadonlyArray - | AnimatedNode, + ReadonlyArray | AnimatedNode, }, >, >, @@ -94,6 +93,5 @@ 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 36f67b2217c2..f733c96c9645 100644 --- a/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js +++ b/packages/react-native/Libraries/StyleSheet/processBackgroundImage.js @@ -39,8 +39,7 @@ 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', @@ -77,8 +76,7 @@ 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 5a65087c0794..24c9aac73023 100644 --- a/packages/react-native/Libraries/Utilities/PlatformTypes.js +++ b/packages/react-native/Libraries/Utilities/PlatformTypes.js @@ -9,12 +9,7 @@ */ 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 @@ -259,8 +254,4 @@ 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 1b04aeb0ad4c..48c689116154 100644 --- a/packages/react-native/Libraries/Utilities/useWindowDimensions.js +++ b/packages/react-native/Libraries/Utilities/useWindowDimensions.js @@ -22,8 +22,7 @@ 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 64fd2d2b1a64..a7045edfb507 100644 --- a/packages/react-native/flow/bom.js.flow +++ b/packages/react-native/flow/bom.js.flow @@ -81,7 +81,6 @@ declare var console: { // Stack tagging createTask(label: string): ConsoleTask, - ... }; @@ -515,9 +514,7 @@ 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? @@ -599,12 +596,7 @@ 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 50bd5c15deac..6633fbecf443 100644 --- a/packages/react-native/flow/cssom.js.flow +++ b/packages/react-native/flow/cssom.js.flow @@ -409,10 +409,7 @@ 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'; @@ -481,12 +478,7 @@ 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 55e96b385ebd..038a6f01493b 100644 --- a/packages/react-native/flow/dom.js.flow +++ b/packages/react-native/flow/dom.js.flow @@ -172,68 +172,52 @@ 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; @@ -242,8 +226,7 @@ type SecurityPolicyViolationEventListener = | SecurityPolicyViolationEventHandler; type USBConnectionEventHandler = (event: USBConnectionEvent) => unknown; type USBConnectionEventListener = - | {handleEvent: USBConnectionEventHandler, ...} - | USBConnectionEventHandler; + {handleEvent: USBConnectionEventHandler, ...} | USBConnectionEventHandler; type MediaKeySessionType = 'temporary' | 'persistent-license'; type MediaKeyStatus = @@ -272,13 +255,7 @@ 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' @@ -300,15 +277,10 @@ 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'; @@ -6051,8 +6023,7 @@ 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 dd1c39999b1f..42a67b762c32 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 086d3f9bbe05..acec7193a8ae 100644 --- a/packages/react-native/scripts/featureflags/types.js +++ b/packages/react-native/scripts/featureflags/types.js @@ -23,10 +23,7 @@ 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 52817be7732e..76b13411730f 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 12a34399221c..5253243ef670 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,9 +19,7 @@ export opaque type NativeElementReference = ShadowNode; export opaque type NativeTextReference = ShadowNode; export type NativeNodeReference = - | NativeElementReference - | NativeTextReference - | RootTag; + NativeElementReference | NativeTextReference | RootTag; export type MeasureInWindowOnSuccessCallback = ( x: number, @@ -58,16 +56,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 */, @@ -79,24 +77,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 */, @@ -127,7 +125,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. @@ -136,7 +134,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 7440f670a96a..ac6eda8c618a 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,14 +38,12 @@ 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 9e4fa32fe455..aef916f4e7f1 100644 --- a/packages/react-native/src/private/webapis/performance/PerformanceEntry.js +++ b/packages/react-native/src/private/webapis/performance/PerformanceEntry.js @@ -14,11 +14,7 @@ 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 de5ee16441f4..45af579fcd7f 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestTypes.js @@ -25,8 +25,7 @@ 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 4ee3377ff31f..9bf56b7f6a16 100644 --- a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js +++ b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js @@ -49,8 +49,7 @@ 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 298331a0b839..a8593403e4cd 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 55a63f8866ff..b9551b655421 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -131,10 +131,8 @@ type State = {childProps: VirtualizedListProps, ...}; */ class VirtualizedSectionList< ItemT, - SectionT extends SectionBase< - ItemT, + SectionT extends SectionBase = DefaultVirtualizedSectionT, - > = DefaultVirtualizedSectionT, > extends React.PureComponent< VirtualizedSectionListProps, State, @@ -643,10 +641,8 @@ function ItemWithSeparator( const VirtualizedSectionListComponent = VirtualizedSectionList as component< ItemT, - SectionT extends SectionBase< - ItemT, + SectionT extends SectionBase = 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 37a8b297ff73..f564d7f8e8ec 100644 --- a/private/react-native-fantom/src/Benchmark.js +++ b/private/react-native-fantom/src/Benchmark.js @@ -61,8 +61,7 @@ type SuiteResults = Array>; type TestWithArgName = string | ((testArg: TestArgType) => string); type TestWithArgOptions = - | FnOptions - | ((testArg: TestArgType) => FnOptions); + FnOptions | ((testArg: TestArgType) => FnOptions); interface ParameterizedTestFunction { (