diff --git a/jest/preprocessor.js b/jest/preprocessor.js index ae9f6dd90b9..49b3c3755b3 100644 --- a/jest/preprocessor.js +++ b/jest/preprocessor.js @@ -12,6 +12,8 @@ 'use strict'; +/* eslint-disable lint/sort-imports */ + const metroBabelRegister = require('metro-babel-register'); const nullthrows = require('nullthrows'); const createCacheKeyFunction = diff --git a/packages/babel-plugin-codegen/__tests__/index-test.js b/packages/babel-plugin-codegen/__tests__/index-test.js index 20195b5ea40..1f73d197578 100644 --- a/packages/babel-plugin-codegen/__tests__/index-test.js +++ b/packages/babel-plugin-codegen/__tests__/index-test.js @@ -10,9 +10,9 @@ 'use strict'; -const {transform: babelTransform} = require('@babel/core'); -const fixtures = require('../__test_fixtures__/fixtures.js'); const failures = require('../__test_fixtures__/failures.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const {transform: babelTransform} = require('@babel/core'); const transform = (fixture, filename) => babelTransform(fixture, { diff --git a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js index 3f5074674e3..27ce49565ab 100644 --- a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js +++ b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js @@ -11,10 +11,10 @@ import getAssetDestPathAndroid from '../getAssetDestPathAndroid'; -jest.dontMock('../getAssetDestPathAndroid').dontMock('../assetPathUtils'); - const path = require('path'); +jest.dontMock('../getAssetDestPathAndroid').dontMock('../assetPathUtils'); + describe('getAssetDestPathAndroid', () => { test('should use the right destination folder', () => { const asset = { diff --git a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js index 1e807f12391..2709141eba7 100644 --- a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js +++ b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js @@ -11,10 +11,10 @@ import getAssetDestPathIOS from '../getAssetDestPathIOS'; -jest.dontMock('../getAssetDestPathIOS'); - const path = require('path'); +jest.dontMock('../getAssetDestPathIOS'); + describe('getAssetDestPathIOS', () => { test('should build correct path', () => { const asset = { diff --git a/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js b/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js index 7b6c1acb017..6adc884e3a8 100644 --- a/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js +++ b/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js @@ -11,9 +11,9 @@ import type {AssetData} from 'metro/src/Assets'; -import path from 'path'; -import fs from 'fs'; import assetPathUtils from './assetPathUtils'; +import fs from 'fs'; +import path from 'path'; export function cleanAssetCatalog(catalogDir: string): void { const files = fs diff --git a/packages/community-cli-plugin/src/commands/bundle/buildBundle.js b/packages/community-cli-plugin/src/commands/bundle/buildBundle.js index 525f46748bb..f5e629f4cca 100644 --- a/packages/community-cli-plugin/src/commands/bundle/buildBundle.js +++ b/packages/community-cli-plugin/src/commands/bundle/buildBundle.js @@ -10,17 +10,17 @@ */ import type {Config} from '@react-native-community/cli-types'; -import type {RequestOptions} from 'metro/src/shared/types.flow'; import type {ConfigT} from 'metro-config'; +import type {RequestOptions} from 'metro/src/shared/types.flow'; +import loadMetroConfig from '../../utils/loadMetroConfig'; +import saveAssets from './saveAssets'; +import {logger} from '@react-native-community/cli-tools'; +import chalk from 'chalk'; import Server from 'metro/src/Server'; import metroBundle from 'metro/src/shared/output/bundle'; import metroRamBundle from 'metro/src/shared/output/RamBundle'; import path from 'path'; -import chalk from 'chalk'; -import saveAssets from './saveAssets'; -import loadMetroConfig from '../../utils/loadMetroConfig'; -import {logger} from '@react-native-community/cli-tools'; export type BundleCommandArgs = { assetsDest?: string, diff --git a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js index 20f9ec781c3..5e005112ce6 100644 --- a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js +++ b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js @@ -11,8 +11,8 @@ import type {PackagerAsset} from './assetPathUtils'; -import path from 'path'; import assetPathUtils from './assetPathUtils'; +import path from 'path'; function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string { const androidFolder = assetPathUtils.getAndroidResourceFolderName( diff --git a/packages/community-cli-plugin/src/commands/bundle/index.js b/packages/community-cli-plugin/src/commands/bundle/index.js index 6a480c4e333..5dba17d220b 100644 --- a/packages/community-cli-plugin/src/commands/bundle/index.js +++ b/packages/community-cli-plugin/src/commands/bundle/index.js @@ -11,8 +11,8 @@ import type {Command} from '@react-native-community/cli-types'; -import path from 'path'; import buildBundle from './buildBundle'; +import path from 'path'; export type {BundleCommandArgs} from './buildBundle'; diff --git a/packages/community-cli-plugin/src/commands/bundle/saveAssets.js b/packages/community-cli-plugin/src/commands/bundle/saveAssets.js index b4183c31e05..1aae31542fd 100644 --- a/packages/community-cli-plugin/src/commands/bundle/saveAssets.js +++ b/packages/community-cli-plugin/src/commands/bundle/saveAssets.js @@ -11,9 +11,6 @@ import type {AssetData} from 'metro/src/Assets'; -import {logger} from '@react-native-community/cli-tools'; -import fs from 'fs'; -import path from 'path'; import { cleanAssetCatalog, getImageSet, @@ -23,6 +20,9 @@ import { import filterPlatformAssetScales from './filterPlatformAssetScales'; import getAssetDestPathAndroid from './getAssetDestPathAndroid'; import getAssetDestPathIOS from './getAssetDestPathIOS'; +import {logger} from '@react-native-community/cli-tools'; +import fs from 'fs'; +import path from 'path'; type CopiedFiles = { [src: string]: string, diff --git a/packages/community-cli-plugin/src/commands/ram-bundle/index.js b/packages/community-cli-plugin/src/commands/ram-bundle/index.js index 1cf978ffc8d..eeed0819cfe 100644 --- a/packages/community-cli-plugin/src/commands/ram-bundle/index.js +++ b/packages/community-cli-plugin/src/commands/ram-bundle/index.js @@ -9,12 +9,12 @@ * @oncall react_native */ -import type {Command, Config} from '@react-native-community/cli-types'; import type {BundleCommandArgs} from '../bundle'; +import type {Command, Config} from '@react-native-community/cli-types'; -import metroRamBundle from 'metro/src/shared/output/RamBundle'; import bundleCommand from '../bundle'; import buildBundle from '../bundle/buildBundle'; +import metroRamBundle from 'metro/src/shared/output/RamBundle'; const ramBundleCommand: Command = { name: 'ram-bundle', diff --git a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js index 13eb813f7c8..06f7c3ec234 100644 --- a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js +++ b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js @@ -11,11 +11,11 @@ import type {Config} from '@react-native-community/cli-types'; +import {KeyPressHandler} from '../../utils/KeyPressHandler'; import {logger} from '@react-native-community/cli-tools'; import chalk from 'chalk'; import execa from 'execa'; import fetch from 'node-fetch'; -import {KeyPressHandler} from '../../utils/KeyPressHandler'; const CTRL_C = '\u0003'; const CTRL_D = '\u0004'; diff --git a/packages/community-cli-plugin/src/commands/start/index.js b/packages/community-cli-plugin/src/commands/start/index.js index 88028746183..7cc22efb661 100644 --- a/packages/community-cli-plugin/src/commands/start/index.js +++ b/packages/community-cli-plugin/src/commands/start/index.js @@ -11,8 +11,8 @@ import type {Command} from '@react-native-community/cli-types'; -import path from 'path'; import runServer from './runServer'; +import path from 'path'; export type {StartCommandArgs} from './runServer'; diff --git a/packages/community-cli-plugin/src/commands/start/runServer.js b/packages/community-cli-plugin/src/commands/start/runServer.js index b6683cd3795..7b11adc629b 100644 --- a/packages/community-cli-plugin/src/commands/start/runServer.js +++ b/packages/community-cli-plugin/src/commands/start/runServer.js @@ -14,21 +14,20 @@ import type {Reporter} from 'metro/src/lib/reporting'; import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter'; import typeof TerminalReporter from 'metro/src/lib/TerminalReporter'; -import chalk from 'chalk'; -import Metro from 'metro'; -import {Terminal} from 'metro-core'; -import path from 'path'; -import url from 'url'; -import {createDevMiddleware} from '@react-native/dev-middleware'; +import isDevServerRunning from '../../utils/isDevServerRunning'; +import loadMetroConfig from '../../utils/loadMetroConfig'; +import attachKeyHandlers from './attachKeyHandlers'; import { createDevServerMiddleware, indexPageMiddleware, } from '@react-native-community/cli-server-api'; import {logger, version} from '@react-native-community/cli-tools'; - -import isDevServerRunning from '../../utils/isDevServerRunning'; -import loadMetroConfig from '../../utils/loadMetroConfig'; -import attachKeyHandlers from './attachKeyHandlers'; +import {createDevMiddleware} from '@react-native/dev-middleware'; +import chalk from 'chalk'; +import Metro from 'metro'; +import {Terminal} from 'metro-core'; +import path from 'path'; +import url from 'url'; export type StartCommandArgs = { assetPlugins?: string[], diff --git a/packages/community-cli-plugin/src/utils/loadMetroConfig.js b/packages/community-cli-plugin/src/utils/loadMetroConfig.js index ce3b6f36f42..c8430c9b9e4 100644 --- a/packages/community-cli-plugin/src/utils/loadMetroConfig.js +++ b/packages/community-cli-plugin/src/utils/loadMetroConfig.js @@ -12,10 +12,10 @@ import type {Config} from '@react-native-community/cli-types'; import type {ConfigT, InputConfigT, YargArguments} from 'metro-config'; -import path from 'path'; -import {loadConfig, mergeConfig, resolveConfig} from 'metro-config'; -import {CLIError, logger} from '@react-native-community/cli-tools'; import {reactNativePlatformResolver} from './metroPlatformResolver'; +import {CLIError, logger} from '@react-native-community/cli-tools'; +import {loadConfig, mergeConfig, resolveConfig} from 'metro-config'; +import path from 'path'; export type {Config}; diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index c73d19a1737..1396a7b6bd0 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -9,20 +9,20 @@ * @oncall react_native */ -import type {NextHandleFunction} from 'connect'; import type {BrowserLauncher} from './types/BrowserLauncher'; import type {EventReporter} from './types/EventReporter'; import type {Experiments, ExperimentsConfig} from './types/Experiments'; import type {Logger} from './types/Logger'; +import type {NextHandleFunction} from 'connect'; +import InspectorProxy from './inspector-proxy/InspectorProxy'; +import deprecated_openFlipperMiddleware from './middleware/deprecated_openFlipperMiddleware'; +import openDebuggerMiddleware from './middleware/openDebuggerMiddleware'; +import DefaultBrowserLauncher from './utils/DefaultBrowserLauncher'; import reactNativeDebuggerFrontendPath from '@react-native/debugger-frontend'; import connect from 'connect'; import path from 'path'; import serveStaticMiddleware from 'serve-static'; -import deprecated_openFlipperMiddleware from './middleware/deprecated_openFlipperMiddleware'; -import openDebuggerMiddleware from './middleware/openDebuggerMiddleware'; -import InspectorProxy from './inspector-proxy/InspectorProxy'; -import DefaultBrowserLauncher from './utils/DefaultBrowserLauncher'; type Options = $ReadOnly<{ projectRoot: string, diff --git a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js index e8776170932..af574d15212 100644 --- a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js +++ b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js @@ -9,6 +9,7 @@ */ import type {EventReporter} from '../types/EventReporter'; + import TTLCache from '@isaacs/ttlcache'; type PendingCommand = { diff --git a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js index d0897f2eee3..ead03c540c3 100644 --- a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js +++ b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js @@ -9,19 +9,19 @@ * @oncall react_native */ +import type {EventReporter} from '../types/EventReporter'; +import type {Experiments} from '../types/Experiments'; import type { JsonPagesListResponse, JsonVersionResponse, Page, PageDescription, } from './types'; -import type {EventReporter} from '../types/EventReporter'; -import type {Experiments} from '../types/Experiments'; import type {IncomingMessage, ServerResponse} from 'http'; +import Device from './Device'; import url from 'url'; import WS from 'ws'; -import Device from './Device'; const debug = require('debug')('Metro:InspectorProxy'); diff --git a/packages/dev-middleware/src/middleware/deprecated_openFlipperMiddleware.js b/packages/dev-middleware/src/middleware/deprecated_openFlipperMiddleware.js index 35a222ce7f0..6a2d07a5f03 100644 --- a/packages/dev-middleware/src/middleware/deprecated_openFlipperMiddleware.js +++ b/packages/dev-middleware/src/middleware/deprecated_openFlipperMiddleware.js @@ -9,9 +9,9 @@ * @oncall react_native */ +import type {Logger} from '../types/Logger'; import type {NextHandleFunction} from 'connect'; import type {IncomingMessage, ServerResponse} from 'http'; -import type {Logger} from '../types/Logger'; import open from 'open'; diff --git a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js index 6767a45d086..0fbf4933708 100644 --- a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js +++ b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js @@ -9,16 +9,16 @@ * @oncall react_native */ -import type {NextHandleFunction} from 'connect'; -import type {IncomingMessage, ServerResponse} from 'http'; import type {InspectorProxyQueries} from '../inspector-proxy/InspectorProxy'; import type {BrowserLauncher, LaunchedBrowser} from '../types/BrowserLauncher'; import type {EventReporter} from '../types/EventReporter'; import type {Experiments} from '../types/Experiments'; import type {Logger} from '../types/Logger'; +import type {NextHandleFunction} from 'connect'; +import type {IncomingMessage, ServerResponse} from 'http'; -import url from 'url'; import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl'; +import url from 'url'; const debuggerInstances = new Map(); diff --git a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js index 76e799f3cb5..fceb13bb7ac 100644 --- a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js +++ b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js @@ -10,9 +10,8 @@ 'use strict'; -const ESLintTester = require('./eslint-tester.js'); - const rule = require('../platform-colors.js'); +const ESLintTester = require('./eslint-tester.js'); const eslintTester = new ESLintTester(); diff --git a/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js index ae3b5c62ac6..0704665af23 100644 --- a/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js +++ b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js @@ -10,9 +10,8 @@ 'use strict'; -const ESLintTester = require('./eslint-tester.js'); - const rule = require('../react-native-modules'); +const ESLintTester = require('./eslint-tester.js'); const NATIVE_MODULES_DIR = __dirname; diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 9f142919d9e..a9b8920cfca 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -10,8 +10,8 @@ 'use strict'; -const path = require('path'); const withBabelRegister = require('./with-babel-register'); +const path = require('path'); // We use the prepack hook before publishing package to set this value to true const PACKAGE_USAGE = false; diff --git a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js index c8400367752..a468c7b6d71 100644 --- a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js +++ b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js @@ -8,10 +8,10 @@ * @oncall react_native */ -const path = require('path'); const fs = require('fs'); -const os = require('os'); const {sync: makeDirSync} = require('make-dir'); +const os = require('os'); +const path = require('path'); const packageJson = JSON.parse( fs.readFileSync(require.resolve('../package.json'), 'utf8'), diff --git a/packages/eslint-plugin-specs/with-babel-register/index.js b/packages/eslint-plugin-specs/with-babel-register/index.js index e4fe1450367..77f9fb6e1bf 100644 --- a/packages/eslint-plugin-specs/with-babel-register/index.js +++ b/packages/eslint-plugin-specs/with-babel-register/index.js @@ -8,13 +8,13 @@ * @oncall react_native */ -const babel = require('@babel/core'); -const {OptionManager, DEFAULT_EXTENSIONS} = require('@babel/core'); -const sourceMapSupport = require('source-map-support'); -const {addHook} = require('pirates'); -const path = require('path'); -const fs = require('fs'); const diskCache = require('./disk-cache'); +const babel = require('@babel/core'); +const {DEFAULT_EXTENSIONS, OptionManager} = require('@babel/core'); +const fs = require('fs'); +const path = require('path'); +const {addHook} = require('pirates'); +const sourceMapSupport = require('source-map-support'); function compile(sourceMapManager, cache, options, code, filename) { const opts = new OptionManager().init({ diff --git a/packages/hermes-inspector-msggen/__tests__/header-writer-test.js b/packages/hermes-inspector-msggen/__tests__/header-writer-test.js index 5ba2bb2a115..e793c803cdf 100644 --- a/packages/hermes-inspector-msggen/__tests__/header-writer-test.js +++ b/packages/hermes-inspector-msggen/__tests__/header-writer-test.js @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import {expectCodeIsEqual, FakeWritable} from '../src/TestHelpers'; +import { Command } from '../src/Command'; +import { Event } from '../src/Event'; import { emitNotificationDecl, emitRequestDecl, emitResponseDecl, emitTypeDecl, } from '../src/HeaderWriter'; -import { Event } from '../src/Event'; -import { Command } from '../src/Command'; +import {FakeWritable, expectCodeIsEqual} from '../src/TestHelpers'; import { Type } from '../src/Type'; let stream = null; diff --git a/packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js b/packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js index 6ad01e08231..8d83a9cc67c 100644 --- a/packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js +++ b/packages/hermes-inspector-msggen/__tests__/implementation-writer-test.js @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import {expectCodeIsEqual, FakeWritable} from '../src/TestHelpers'; +import { Command } from '../src/Command'; +import { Event } from '../src/Event'; import { emitNotificationDef, emitRequestDef, emitResponseDef, emitTypeDef, } from '../src/ImplementationWriter'; -import { Event } from '../src/Event'; -import { Command } from '../src/Command'; +import {FakeWritable, expectCodeIsEqual} from '../src/TestHelpers'; import { Type } from '../src/Type'; let stream = null; diff --git a/packages/hermes-inspector-msggen/src/Command.js b/packages/hermes-inspector-msggen/src/Command.js index feed094bb12..f6da8dffa8c 100644 --- a/packages/hermes-inspector-msggen/src/Command.js +++ b/packages/hermes-inspector-msggen/src/Command.js @@ -8,8 +8,8 @@ * @format */ -import {Property} from './Property'; import {toCppNamespace, toCppType} from './Converters'; +import {Property} from './Property'; export class Command { domain: string; diff --git a/packages/hermes-inspector-msggen/src/Event.js b/packages/hermes-inspector-msggen/src/Event.js index 10e9ee97422..bb9f2c4f565 100644 --- a/packages/hermes-inspector-msggen/src/Event.js +++ b/packages/hermes-inspector-msggen/src/Event.js @@ -8,8 +8,8 @@ * @format */ -import {Property} from './Property'; import {toCppNamespace, toCppType} from './Converters'; +import {Property} from './Property'; export class Event { domain: string; diff --git a/packages/hermes-inspector-msggen/src/HeaderWriter.js b/packages/hermes-inspector-msggen/src/HeaderWriter.js index 49e20c62b33..612e44e783a 100644 --- a/packages/hermes-inspector-msggen/src/HeaderWriter.js +++ b/packages/hermes-inspector-msggen/src/HeaderWriter.js @@ -8,14 +8,13 @@ * @format */ -import {Writable} from 'stream'; - +import {Command} from './Command'; +import {toCppNamespace} from './Converters'; +import {Event} from './Event'; import {GeneratedHeader} from './GeneratedHeader'; import {Property} from './Property'; import {PropsType, Type} from './Type'; -import {Command} from './Command'; -import {Event} from './Event'; -import {toCppNamespace} from './Converters'; +import {Writable} from 'stream'; export class HeaderWriter { stream: Writable; diff --git a/packages/hermes-inspector-msggen/src/ImplementationWriter.js b/packages/hermes-inspector-msggen/src/ImplementationWriter.js index 955b8f352bd..030cee099f0 100644 --- a/packages/hermes-inspector-msggen/src/ImplementationWriter.js +++ b/packages/hermes-inspector-msggen/src/ImplementationWriter.js @@ -8,12 +8,11 @@ * @format */ -import {Writable} from 'stream'; - -import {GeneratedHeader} from './GeneratedHeader'; -import {PropsType, Type} from './Type'; import {Command} from './Command'; import {Event} from './Event'; +import {GeneratedHeader} from './GeneratedHeader'; +import {PropsType, Type} from './Type'; +import {Writable} from 'stream'; export class ImplementationWriter { stream: Writable; diff --git a/packages/hermes-inspector-msggen/src/Property.js b/packages/hermes-inspector-msggen/src/Property.js index fdad9bc6f7b..a6739160357 100644 --- a/packages/hermes-inspector-msggen/src/Property.js +++ b/packages/hermes-inspector-msggen/src/Property.js @@ -9,10 +9,10 @@ */ import { + type JsTypeString, jsTypeToCppType, toCppNamespace, toCppType, - type JsTypeString, } from './Converters'; export class Property { diff --git a/packages/hermes-inspector-msggen/src/Type.js b/packages/hermes-inspector-msggen/src/Type.js index eef2a4265a8..9371fbce0f2 100644 --- a/packages/hermes-inspector-msggen/src/Type.js +++ b/packages/hermes-inspector-msggen/src/Type.js @@ -8,8 +8,8 @@ * @format */ -import {Property} from './Property'; import {jsTypeToCppType, toCppNamespace, toCppType} from './Converters'; +import {Property} from './Property'; export class Type { domain: string; diff --git a/packages/hermes-inspector-msggen/src/index.js b/packages/hermes-inspector-msggen/src/index.js index dd6c488f605..761390faca7 100644 --- a/packages/hermes-inspector-msggen/src/index.js +++ b/packages/hermes-inspector-msggen/src/index.js @@ -8,23 +8,19 @@ * @format */ -import fs from 'fs'; - -import yargs from 'yargs'; - import {Command} from './Command'; import {Event} from './Event'; import {Graph} from './Graph'; -import {Property} from './Property'; -import {PropsType, Type} from './Type'; - import {HeaderWriter} from './HeaderWriter'; import {ImplementationWriter} from './ImplementationWriter'; - -// $FlowFixMe[cannot-resolve-module] : this isn't a module, just a JSON file. -const standard = require('devtools-protocol/json/js_protocol.json'); +import {Property} from './Property'; +import {PropsType, Type} from './Type'; +import fs from 'fs'; +import yargs from 'yargs'; const custom = require('../src/custom.json'); +// $FlowFixMe[cannot-resolve-module] : this isn't a module, just a JSON file. +const standard = require('devtools-protocol/json/js_protocol.json'); type Descriptor = {| types: Array, diff --git a/packages/react-native-babel-transformer/src/index.js b/packages/react-native-babel-transformer/src/index.js index 80ed9cafba8..b82be63b12f 100644 --- a/packages/react-native-babel-transformer/src/index.js +++ b/packages/react-native-babel-transformer/src/index.js @@ -24,9 +24,9 @@ import type { */ const {parseSync, transformFromAstSync} = require('@babel/core'); +const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr'); const crypto = require('crypto'); const fs = require('fs'); -const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr'); const nullthrows = require('nullthrows'); const path = require('path'); diff --git a/packages/react-native-bots/dangerfile.js b/packages/react-native-bots/dangerfile.js index 9b3f372b353..2030c01f2c2 100644 --- a/packages/react-native-bots/dangerfile.js +++ b/packages/react-native-bots/dangerfile.js @@ -9,12 +9,12 @@ 'use strict'; -const {danger, fail, /*message,*/ warn} = require('danger'); -const includes = require('lodash.includes'); -const eslint = require('@seadub/danger-plugin-eslint'); -const fetch = require('node-fetch'); const {validate: validateChangelog} = require('@rnx-kit/rn-changelog-generator').default; +const eslint = require('@seadub/danger-plugin-eslint'); +const {danger, fail, /*message,*/ warn} = require('danger'); +const includes = require('lodash.includes'); +const fetch = require('node-fetch'); const isFromPhabricator = danger.github.pr.body && diff --git a/packages/react-native-bots/report-bundle-size.js b/packages/react-native-bots/report-bundle-size.js index 35d1f468c42..411332cf26d 100644 --- a/packages/react-native-bots/report-bundle-size.js +++ b/packages/react-native-bots/report-bundle-size.js @@ -18,12 +18,12 @@ const { GITHUB_SHA, } = process.env; -const fs = require('fs'); const datastore = require('./datastore'); const { createOrUpdateComment, validateEnvironment: validateEnvironmentForMakeComment, } = require('./make-comment'); +const fs = require('fs'); /** * Generates and submits a comment. If this is run on the main or release branch, data is diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js index 95806046fae..1b46fd1b88e 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js @@ -8,21 +8,22 @@ * @flow strict-local */ +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { DimensionValue, EdgeInsetsValue, PointValue, } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; import type { - Int32, Float, + Int32, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; + import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js index f42d3ef33b4..31d27759683 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js index a83dd75323a..09ad4baeee3 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js index 5cd34dd81a4..4ca8fc37a2a 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/DimensionPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js index 08dba01767c..95a70164755 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js @@ -9,9 +9,10 @@ */ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js index 121435c3054..d4394e662e2 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js index 59086b66b85..8e0b0fc5d7c 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js @@ -8,14 +8,15 @@ * @flow strict-local */ +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type { - Int32, BubblingEventHandler, + Int32, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; + import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; type OnChangeEvent = $ReadOnly<{| location: { diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js index 5b5d4a9cfee..4d414adbceb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js @@ -8,16 +8,17 @@ * @flow strict-local */ +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type { - Int32, - Float, BubblingEventHandler, DirectEventHandler, + Float, + Int32, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; + import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; type OnChangeEvent = $ReadOnly<{| value: boolean, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js index db170d5961e..1bd65ccd564 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js @@ -8,13 +8,14 @@ * @flow strict-local */ -import type { - WithDefault, - Float, -} from 'react-native/Libraries/Types/CodegenTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type { + Float, + WithDefault, +} from 'react-native/Libraries/Types/CodegenTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js index 77f56799d8c..8c08d112f70 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js @@ -8,11 +8,12 @@ * @flow strict-local */ -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js index cbffaa60174..8f7400a8f05 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js @@ -8,13 +8,14 @@ * @flow strict-local */ -import type { - WithDefault, - Int32, -} from 'react-native/Libraries/Types/CodegenTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type { + Int32, + WithDefault, +} from 'react-native/Libraries/Types/CodegenTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js index 4832d0608e7..8a5e39ce000 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js @@ -8,13 +8,14 @@ * @flow strict-local */ +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type { BubblingEventHandler, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; + import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js index 41169339f73..883ff8a398e 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/MixedPropNativeComponent.js @@ -9,10 +9,11 @@ */ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type {UnsafeMixed} from 'react-native/Libraries/Types/CodegenTypes'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js index 3ff7f1f4104..af1b2fb1eba 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js @@ -8,12 +8,13 @@ * @flow strict-local */ -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; -import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; +import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js index a8ba611ce93..6ac37dda0ce 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js @@ -9,9 +9,10 @@ */ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js index 09c518fc1a4..85ad5d590ae 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js @@ -10,15 +10,16 @@ import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; import type {ImageSource} from 'react-native/Libraries/Image/ImageSource'; -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; import type { - Int32, Float, + Int32, WithDefault, } from 'react-native/Libraries/Types/CodegenTypes'; + import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; type ObjectArrayPropType = $ReadOnly<{| array: $ReadOnlyArray, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js index 7c27ce01958..772e079c032 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js index a34d17dab94..3246f622970 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes'; + +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js index 5b7d621a655..c132fce4776 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type ArrayType = string; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js index a898b130288..2eeae4e6c53 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type Boolean = boolean; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js index 71bb14cf72f..5bac9222beb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type String = string; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js index 1dbeeec74d8..1a24614fecd 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type StateType = {| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js index e56e0346ad1..41b524a8681 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js index e47a31a2d3e..ac86df6b053 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type Number = number; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js index e3b2d5df8c5..7dbc21c6c81 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type GenericObject = Object; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js index 692bd52ff73..37d1a5c47cb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js index 42b15f68d47..3e01c1cc5ed 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePartialAnnotationTurboModule.js @@ -11,6 +11,7 @@ 'use strict'; import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type SomeObj = {| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js index 610b3bab899..023524505d6 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type String = string; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js index 12496b4ec75..57871b1035a 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js @@ -12,6 +12,7 @@ import type { RootTag, TurboModule, } from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; type Animal = {| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js index d320bd2fb33..940cc75fd8c 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js @@ -12,6 +12,7 @@ import type { RootTag, TurboModule, } from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; type Animal = {| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js index 2a736f08e92..a96b0ae731d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js @@ -12,6 +12,7 @@ import type { RootTag, TurboModule, } from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; type Animal = ?{| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js index b8981a22ab2..fb5b66631f3 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js @@ -12,6 +12,7 @@ import type { RootTag, TurboModule, } from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; type Animal = ?{| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js index d1b56f98938..820e99a5cad 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js @@ -12,6 +12,7 @@ import type { RootTag, TurboModule, } from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; type Animal = {| diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js index b78372382b8..810351eb1aa 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; + import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; export type String = string; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js index 3e12f2afa95..d6e0e06267e 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateComponentDescriptorH'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js index 50959ea33a8..0fefa3b2c98 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateComponentHObjCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js index 177ec1dccb9..da247b4b5af 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateEventEmitterCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js index 962c57ef404..2be17160beb 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateEventEmitterH'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js index b6d0f5e9792..77ed2f1a24a 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GeneratePropsCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js index 6c60a966c34..41588ee3c02 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GeneratePropsH'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js index 3a3a2135cb2..9384ad968cc 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GeneratePropsJavaDelegate'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js index 14a807fd02b..1cc29a6b7cc 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GeneratePropsJavaInterface'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js index a7a766b1a56..9e594a8543e 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateShadowNodeCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js index 87cc703a17a..10a80ddb69a 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateShadowNodeH'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js index 833866e473d..a5ab0bb7415 100644 --- a/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js @@ -11,8 +11,8 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); const generator = require('../../../src/generators/components/GenerateViewConfigJs'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); const fs = require('fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleCpp-test.js b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleCpp-test.js index 662a8fd0ddb..b105c40966a 100644 --- a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleCpp-test.js @@ -11,12 +11,12 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); -const generator = require('../../../src/generators/modules/GenerateModuleCpp'); -const fs = require('fs'); - import type {SchemaType} from '../../../src/CodegenSchema'; +const generator = require('../../../src/generators/modules/GenerateModuleCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); +const fs = require('fs'); + const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`; const parser = new FlowParser(); diff --git a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleH-test.js b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleH-test.js index 51b6c8e37b6..ae9364936ec 100644 --- a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleH-test.js +++ b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleH-test.js @@ -11,12 +11,12 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); -const generator = require('../../../src/generators/modules/GenerateModuleH'); -const fs = require('fs'); - import type {SchemaType} from '../../../src/CodegenSchema'; +const generator = require('../../../src/generators/modules/GenerateModuleH'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); +const fs = require('fs'); + const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`; const parser = new FlowParser(); diff --git a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js index 9e043428607..607afcf771b 100644 --- a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js @@ -11,12 +11,12 @@ 'use strict'; -const {FlowParser} = require('../../../src/parsers/flow/parser'); -const generator = require('../../../src/generators/modules/GenerateModuleObjCpp'); -const fs = require('fs'); - import type {SchemaType} from '../../../src/CodegenSchema'; +const generator = require('../../../src/generators/modules/GenerateModuleObjCpp'); +const {FlowParser} = require('../../../src/parsers/flow/parser'); +const fs = require('fs'); + const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`; const parser = new FlowParser(); diff --git a/packages/react-native-codegen/src/SchemaValidator.js b/packages/react-native-codegen/src/SchemaValidator.js index 87ded884845..dc59d9cd77b 100644 --- a/packages/react-native-codegen/src/SchemaValidator.js +++ b/packages/react-native-codegen/src/SchemaValidator.js @@ -10,10 +10,10 @@ 'use strict'; -const nullthrows = require('nullthrows'); - import type {SchemaType} from './CodegenSchema'; +const nullthrows = require('nullthrows'); + function getErrors(schema: SchemaType): $ReadOnlyArray { const errors = new Set(); diff --git a/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js b/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js index 4d18b80c4d8..a983168311f 100644 --- a/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js +++ b/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js @@ -11,11 +11,11 @@ 'use strict'; +import type {SchemaType} from '../CodegenSchema.js'; + const fixtures = require('../generators/components/__test_fixtures__/fixtures.js'); const schemaValidator = require('../SchemaValidator.js'); -import type {SchemaType} from '../CodegenSchema.js'; - const simpleProp = { name: 'disabled', optional: true, diff --git a/packages/react-native-codegen/src/cli/combine/__tests__/combine-utils-test.js b/packages/react-native-codegen/src/cli/combine/__tests__/combine-utils-test.js index 84acd9ee556..08b75933d86 100644 --- a/packages/react-native-codegen/src/cli/combine/__tests__/combine-utils-test.js +++ b/packages/react-native-codegen/src/cli/combine/__tests__/combine-utils-test.js @@ -11,7 +11,7 @@ 'use-strict'; -const {parseArgs, filterJSFile} = require('../combine-utils.js'); +const {filterJSFile, parseArgs} = require('../combine-utils.js'); describe('parseArgs', () => { const nodeBin = 'node'; diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js index 6aeff3418a2..b67a92a1a42 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js @@ -12,10 +12,10 @@ 'use strict'; const combine = require('./combine-js-to-schema'); +const {filterJSFile, parseArgs} = require('./combine-utils'); const fs = require('fs'); const glob = require('glob'); const path = require('path'); -const {parseArgs, filterJSFile} = require('./combine-utils'); const {platform, outfile, fileList} = parseArgs(process.argv); diff --git a/packages/react-native-codegen/src/cli/parser/parser.js b/packages/react-native-codegen/src/cli/parser/parser.js index 40a599c9ff9..850e27fff4c 100644 --- a/packages/react-native-codegen/src/cli/parser/parser.js +++ b/packages/react-native-codegen/src/cli/parser/parser.js @@ -10,9 +10,9 @@ 'use strict'; -const path = require('path'); const {FlowParser} = require('../../parsers/flow/parser'); const {TypeScriptParser} = require('../../parsers/typescript/parser'); +const path = require('path'); const flowParser = new FlowParser(); const typescriptParser = new TypeScriptParser(); diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index 61441c715dc..5595ec0bb98 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -16,31 +16,33 @@ TODO: - ViewConfigs should spread in View's valid attributes */ -const fs = require('fs'); +import type {SchemaType} from '../CodegenSchema'; + +const schemaValidator = require('../SchemaValidator.js'); const generateComponentDescriptorH = require('./components/GenerateComponentDescriptorH.js'); const generateComponentHObjCpp = require('./components/GenerateComponentHObjCpp.js'); const generateEventEmitterCpp = require('./components/GenerateEventEmitterCpp.js'); const generateEventEmitterH = require('./components/GenerateEventEmitterH.js'); const generatePropsCpp = require('./components/GeneratePropsCpp.js'); const generatePropsH = require('./components/GeneratePropsH.js'); +const generatePropsJavaDelegate = require('./components/GeneratePropsJavaDelegate.js'); +const generatePropsJavaInterface = require('./components/GeneratePropsJavaInterface.js'); +const generateShadowNodeCpp = require('./components/GenerateShadowNodeCpp.js'); +const generateShadowNodeH = require('./components/GenerateShadowNodeH.js'); const generateStateCpp = require('./components/GenerateStateCpp.js'); const generateStateH = require('./components/GenerateStateH.js'); -const generateModuleH = require('./modules/GenerateModuleH.js'); +const generateTests = require('./components/GenerateTests.js'); +const generateThirdPartyFabricComponentsProviderH = require('./components/GenerateThirdPartyFabricComponentsProviderH.js'); +const generateThirdPartyFabricComponentsProviderObjCpp = require('./components/GenerateThirdPartyFabricComponentsProviderObjCpp.js'); +const generateViewConfigJs = require('./components/GenerateViewConfigJs.js'); const generateModuleCpp = require('./modules/GenerateModuleCpp.js'); -const generateModuleObjCpp = require('./modules/GenerateModuleObjCpp'); +const generateModuleH = require('./modules/GenerateModuleH.js'); const generateModuleJavaSpec = require('./modules/GenerateModuleJavaSpec.js'); const generateModuleJniCpp = require('./modules/GenerateModuleJniCpp.js'); const generateModuleJniH = require('./modules/GenerateModuleJniH.js'); -const generatePropsJavaInterface = require('./components/GeneratePropsJavaInterface.js'); -const generatePropsJavaDelegate = require('./components/GeneratePropsJavaDelegate.js'); -const generateTests = require('./components/GenerateTests.js'); -const generateShadowNodeCpp = require('./components/GenerateShadowNodeCpp.js'); -const generateShadowNodeH = require('./components/GenerateShadowNodeH.js'); -const generateThirdPartyFabricComponentsProviderObjCpp = require('./components/GenerateThirdPartyFabricComponentsProviderObjCpp.js'); -const generateThirdPartyFabricComponentsProviderH = require('./components/GenerateThirdPartyFabricComponentsProviderH.js'); -const generateViewConfigJs = require('./components/GenerateViewConfigJs.js'); +const generateModuleObjCpp = require('./modules/GenerateModuleObjCpp'); +const fs = require('fs'); const path = require('path'); -const schemaValidator = require('../SchemaValidator.js'); const ALL_GENERATORS = { generateComponentDescriptorH: generateComponentDescriptorH.generate, @@ -69,8 +71,6 @@ const ALL_GENERATORS = { generateViewConfigJs: generateViewConfigJs.generate, }; -import type {SchemaType} from '../CodegenSchema'; - type LibraryOptions = $ReadOnly<{ libraryName: string, schema: SchemaType, diff --git a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js index 44a70349ab2..2f8f8f63dbd 100644 --- a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js +++ b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js @@ -11,8 +11,8 @@ 'use strict'; -const rnCodegen = require('../RNCodegen.js'); const fixture = require('../__test_fixtures__/fixtures.js'); +const rnCodegen = require('../RNCodegen.js'); const packageName = 'na'; describe('RNCodegen.generate', () => { diff --git a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js index c43768a1593..3a0138224c0 100644 --- a/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js +++ b/packages/react-native-codegen/src/generators/components/ComponentsGeneratorUtils.js @@ -11,26 +11,24 @@ 'use strict'; import type {NamedShape, PropTypeAnnotation} from '../../CodegenSchema'; - import type { - StringTypeAnnotation, - ReservedPropTypeAnnotation, - ObjectTypeAnnotation, - Int32TypeAnnotation, - FloatTypeAnnotation, - DoubleTypeAnnotation, BooleanTypeAnnotation, + DoubleTypeAnnotation, + FloatTypeAnnotation, + Int32TypeAnnotation, + ObjectTypeAnnotation, + ReservedPropTypeAnnotation, + StringTypeAnnotation, } from '../../CodegenSchema'; +const {getEnumName} = require('../Utils'); const { + generateStructName, getCppTypeForAnnotation, getEnumMaskName, - generateStructName, getImports, } = require('./CppHelpers.js'); -const {getEnumName} = require('../Utils'); - function getNativeTypeFromAnnotation( componentName: string, prop: diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js index ee619f4617f..0d71e25434c 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js @@ -11,11 +11,11 @@ 'use strict'; import type { - NamedShape, + CommandParamTypeAnnotation, CommandTypeAnnotation, ComponentShape, + NamedShape, SchemaType, - CommandParamTypeAnnotation, } from '../../CodegenSchema'; type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 7a43aea0a2b..db983558403 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -10,18 +10,17 @@ 'use strict'; import type {EventTypeShape} from '../../CodegenSchema'; - -const {generateEventStructName} = require('./CppHelpers'); -const {indent} = require('../Utils'); - import type { ComponentShape, - NamedShape, EventTypeAnnotation, - SchemaType, + NamedShape, ObjectTypeAnnotation, + SchemaType, } from '../../CodegenSchema'; +const {indent} = require('../Utils'); +const {generateEventStructName} = require('./CppHelpers'); + // File path -> contents type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index b5d55033f06..5a1bf13b97b 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -10,24 +10,23 @@ 'use strict'; -const nullthrows = require('nullthrows'); - -const { - getImports, - getCppArrayTypeForAnnotation, - getCppTypeForAnnotation, - generateEventStructName, -} = require('./CppHelpers'); -const {indent, toSafeCppString} = require('../Utils'); - import type { ComponentShape, + EventTypeAnnotation, EventTypeShape, NamedShape, - EventTypeAnnotation, SchemaType, } from '../../CodegenSchema'; +const {indent, toSafeCppString} = require('../Utils'); +const { + generateEventStructName, + getCppArrayTypeForAnnotation, + getCppTypeForAnnotation, + getImports, +} = require('./CppHelpers'); +const nullthrows = require('nullthrows'); + // File path -> contents type FilesOutput = Map; type StructsMap = Map; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index ad9d6aac61f..d809193a723 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -11,6 +11,7 @@ 'use strict'; import type {ComponentShape, SchemaType} from '../../CodegenSchema'; + const {convertDefaultTypeToString, getImports} = require('./CppHelpers'); // File path -> contents diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 479c82cd50a..0ec54ced1a4 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -10,21 +10,6 @@ 'use strict'; import type {ComponentShape} from '../../CodegenSchema'; - -const { - getNativeTypeFromAnnotation, - getLocalImports, -} = require('./ComponentsGeneratorUtils.js'); - -const { - convertDefaultTypeToString, - getEnumMaskName, - generateStructName, - toIntEnumValueName, -} = require('./CppHelpers.js'); - -const {getEnumName, toSafeCppString} = require('../Utils'); - import type { ExtendsPropsShape, NamedShape, @@ -32,6 +17,18 @@ import type { SchemaType, } from '../../CodegenSchema'; +const {getEnumName, toSafeCppString} = require('../Utils'); +const { + getLocalImports, + getNativeTypeFromAnnotation, +} = require('./ComponentsGeneratorUtils.js'); +const { + convertDefaultTypeToString, + generateStructName, + getEnumMaskName, + toIntEnumValueName, +} = require('./CppHelpers.js'); + // File path -> contents type FilesOutput = Map; type StructsMap = Map; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js index 68875b3b6ca..a2eb1e8ae8e 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js @@ -10,19 +10,19 @@ 'use strict'; import type {CommandParamTypeAnnotation} from '../../CodegenSchema'; - import type { - NamedShape, CommandTypeAnnotation, ComponentShape, + NamedShape, PropTypeAnnotation, SchemaType, } from '../../CodegenSchema'; + const { - getImports, - toSafeJavaString, - getInterfaceJavaClassName, getDelegateJavaClassName, + getImports, + getInterfaceJavaClassName, + toSafeJavaString, } = require('./JavaHelpers'); // File path -> contents diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js index a71f9b696ed..834ed5ec511 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js @@ -10,18 +10,18 @@ 'use strict'; import type {CommandParamTypeAnnotation} from '../../CodegenSchema'; - import type { - NamedShape, CommandTypeAnnotation, ComponentShape, + NamedShape, PropTypeAnnotation, SchemaType, } from '../../CodegenSchema'; + const { getImports, - toSafeJavaString, getInterfaceJavaClassName, + toSafeJavaString, } = require('./JavaHelpers'); // File path -> contents diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js index 7aaa6d297bf..6f5e19e88fd 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js @@ -11,17 +11,17 @@ 'use strict'; import type { - ReservedPropTypeAnnotation, - NamedShape, - ObjectTypeAnnotation, + ArrayTypeAnnotation, BooleanTypeAnnotation, - StringTypeAnnotation, DoubleTypeAnnotation, FloatTypeAnnotation, Int32TypeAnnotation, - PropTypeAnnotation, MixedTypeAnnotation, - ArrayTypeAnnotation, + NamedShape, + ObjectTypeAnnotation, + PropTypeAnnotation, + ReservedPropTypeAnnotation, + StringTypeAnnotation, } from '../../../CodegenSchema'; const {capitalize} = require('../../Utils'); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js index 66b11f26c8c..a60583debc5 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js @@ -12,8 +12,8 @@ import type {SchemaType} from '../../../CodegenSchema'; -const PojoCollector = require('./PojoCollector'); const {capitalize} = require('../../Utils'); +const PojoCollector = require('./PojoCollector'); const {serializePojo} = require('./serializePojo'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js index f9f7234931f..7ca6df11d08 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js @@ -11,6 +11,7 @@ 'use strict'; import type {Pojo, PojoProperty, PojoTypeAnnotation} from './PojoCollector'; + const {capitalize} = require('../../Utils'); type ImportCollector = ($import: string) => void; diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 95f51da618d..f17f0aa631e 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -12,9 +12,8 @@ import type {ComponentShape, PropTypeAnnotation} from '../../CodegenSchema'; import type {SchemaType} from '../../CodegenSchema'; -const {getImports} = require('./CppHelpers'); - const {toSafeCppString} = require('../Utils'); +const {getImports} = require('./CppHelpers'); type FilesOutput = Map; type PropValueType = string | number | boolean; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js index fa02920516e..75f77115350 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js @@ -11,19 +11,19 @@ 'use strict'; import type { - SchemaType, - Nullable, NamedShape, - NativeModulePropertyShape, + NativeModuleEnumMap, NativeModuleFunctionTypeAnnotation, NativeModuleParamTypeAnnotation, + NativeModulePropertyShape, NativeModuleTypeAnnotation, - NativeModuleEnumMap, + Nullable, + SchemaType, } from '../../CodegenSchema'; - import type {AliasResolver} from './Utils'; -const {createAliasResolver, getModules} = require('./Utils'); + const {unwrapNullable} = require('../../parsers/parsers-commons'); +const {createAliasResolver, getModules} = require('./Utils'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index e2107bde8f8..fe6e05786cb 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -10,33 +10,30 @@ 'use strict'; import type { - NativeModuleBaseTypeAnnotation, NamedShape, + NativeModuleBaseTypeAnnotation, } from '../../CodegenSchema'; - import type { - Nullable, - SchemaType, - NativeModuleTypeAnnotation, - NativeModuleFunctionTypeAnnotation, - NativeModulePropertyShape, NativeModuleAliasMap, NativeModuleEnumMap, NativeModuleEnumMembers, NativeModuleEnumMemberType, + NativeModuleFunctionTypeAnnotation, + NativeModulePropertyShape, + NativeModuleTypeAnnotation, + Nullable, + SchemaType, } from '../../CodegenSchema'; - import type {AliasResolver} from './Utils'; +const {unwrapNullable} = require('../../parsers/parsers-commons'); const {getEnumName, toSafeCppString} = require('../Utils'); - +const {indent} = require('../Utils'); const { createAliasResolver, - getModules, getAreEnumMembersInteger, + getModules, } = require('./Utils'); -const {indent} = require('../Utils'); -const {unwrapNullable} = require('../../parsers/parsers-commons'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 24fba85b697..bcfbc4f9e4e 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -11,18 +11,18 @@ 'use strict'; import type { - Nullable, NamedShape, - SchemaType, - NativeModulePropertyShape, - NativeModuleReturnTypeAnnotation, NativeModuleFunctionTypeAnnotation, NativeModuleParamTypeAnnotation, + NativeModulePropertyShape, + NativeModuleReturnTypeAnnotation, + Nullable, + SchemaType, } from '../../CodegenSchema'; - import type {AliasResolver} from './Utils'; -const {createAliasResolver, getModules} = require('./Utils'); + const {unwrapNullable} = require('../../parsers/parsers-commons'); +const {createAliasResolver, getModules} = require('./Utils'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index ad23221bc4c..ddd534794ff 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -11,18 +11,18 @@ 'use strict'; import type { - Nullable, NamedShape, - SchemaType, + NativeModuleFunctionTypeAnnotation, + NativeModuleParamTypeAnnotation, NativeModulePropertyShape, NativeModuleReturnTypeAnnotation, - NativeModuleParamTypeAnnotation, - NativeModuleFunctionTypeAnnotation, + Nullable, + SchemaType, } from '../../CodegenSchema'; - import type {AliasResolver} from './Utils'; -const {createAliasResolver, getModules} = require('./Utils'); + const {unwrapNullable} = require('../../parsers/parsers-commons'); +const {createAliasResolver, getModules} = require('./Utils'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js index fb980807554..2de35431061 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js @@ -12,10 +12,10 @@ import type {SchemaType} from '../../CodegenSchema'; -type FilesOutput = Map; - const {getModules} = require('./Utils'); +type FilesOutput = Map; + const ModuleClassDeclarationTemplate = ({ hasteModuleName, }: $ReadOnly<{hasteModuleName: string}>) => { diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js index ef7af6ae44a..d85d093948a 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js @@ -11,29 +11,28 @@ 'use strict'; import type { - Nullable, - NativeModuleObjectTypeAnnotation, - NativeModuleStringTypeAnnotation, - NativeModuleNumberTypeAnnotation, - NativeModuleInt32TypeAnnotation, - NativeModuleDoubleTypeAnnotation, - NativeModuleFloatTypeAnnotation, - NativeModuleBooleanTypeAnnotation, - NativeModuleEnumDeclaration, - NativeModuleGenericObjectTypeAnnotation, - ReservedTypeAnnotation, - NativeModuleTypeAliasTypeAnnotation, NativeModuleArrayTypeAnnotation, NativeModuleBaseTypeAnnotation, + NativeModuleBooleanTypeAnnotation, + NativeModuleDoubleTypeAnnotation, + NativeModuleEnumDeclaration, + NativeModuleFloatTypeAnnotation, + NativeModuleGenericObjectTypeAnnotation, + NativeModuleInt32TypeAnnotation, + NativeModuleNumberTypeAnnotation, + NativeModuleObjectTypeAnnotation, + NativeModuleStringTypeAnnotation, + NativeModuleTypeAliasTypeAnnotation, + Nullable, + ReservedTypeAnnotation, } from '../../../CodegenSchema'; - import type {AliasResolver} from '../Utils'; -const {capitalize} = require('../../Utils'); const { unwrapNullable, wrapNullable, } = require('../../../parsers/parsers-commons'); +const {capitalize} = require('../../Utils'); type StructContext = 'CONSTANTS' | 'REGULAR'; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js index 0fa67683e66..c9e8c2d6a0d 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js @@ -10,14 +10,13 @@ 'use strict'; -const {getSafePropertyName, getNamespacedStructName} = require('../Utils'); -const {capitalize} = require('../../../Utils'); - import type {Nullable} from '../../../../CodegenSchema'; -import type {StructTypeAnnotation, ConstantsStruct} from '../StructCollector'; +import type {ConstantsStruct, StructTypeAnnotation} from '../StructCollector'; import type {StructSerilizationOutput} from './serializeStruct'; const {unwrapNullable} = require('../../../../parsers/parsers-commons'); +const {capitalize} = require('../../../Utils'); +const {getNamespacedStructName, getSafePropertyName} = require('../Utils'); const StructTemplate = ({ hasteModuleName, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js index e6c73c73388..ec2a9d2f576 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js @@ -10,14 +10,13 @@ 'use strict'; -const {getSafePropertyName, getNamespacedStructName} = require('../Utils'); -const {capitalize} = require('../../../Utils'); - import type {Nullable} from '../../../../CodegenSchema'; -import type {StructTypeAnnotation, RegularStruct} from '../StructCollector'; +import type {RegularStruct, StructTypeAnnotation} from '../StructCollector'; import type {StructSerilizationOutput} from './serializeStruct'; const {unwrapNullable} = require('../../../../parsers/parsers-commons'); +const {capitalize} = require('../../../Utils'); +const {getNamespacedStructName, getSafePropertyName} = require('../Utils'); const StructTemplate = ({ hasteModuleName, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index 9524327b871..397638dd4c0 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -10,16 +10,14 @@ 'use strict'; import type {NativeModulePropertyShape} from '../../../CodegenSchema'; - import type {SchemaType} from '../../../CodegenSchema'; import type {MethodSerializationOutput} from './serializeMethod'; const {createAliasResolver, getModules} = require('../Utils'); - -const {StructCollector} = require('./StructCollector'); const {serializeStruct} = require('./header/serializeStruct'); const {serializeMethod} = require('./serializeMethod'); const {serializeModuleSource} = require('./source/serializeModule'); +const {StructCollector} = require('./StructCollector'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index 9dcf621c709..40feab503d4 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -11,23 +11,22 @@ 'use strict'; import type { - Nullable, NamedShape, NativeModuleParamTypeAnnotation, - NativeModuleReturnTypeAnnotation, NativeModulePropertyShape, + NativeModuleReturnTypeAnnotation, + Nullable, } from '../../../CodegenSchema'; - import type {AliasResolver} from '../Utils'; import type {StructCollector} from './StructCollector'; -const invariant = require('invariant'); -const {getNamespacedStructName} = require('./Utils'); -const {capitalize} = require('../../Utils'); const { - wrapNullable, unwrapNullable, + wrapNullable, } = require('../../../parsers/parsers-commons'); +const {capitalize} = require('../../Utils'); +const {getNamespacedStructName} = require('./Utils'); +const invariant = require('invariant'); const ProtocolMethodTemplate = ({ returnObjCType, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js index 2d9eb34d256..6d7987d003c 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js @@ -10,11 +10,11 @@ 'use strict'; -import type {Struct} from '../StructCollector'; import type { MethodSerializationOutput, StructParameterRecord, } from '../serializeMethod'; +import type {Struct} from '../StructCollector'; const ModuleTemplate = ({ hasteModuleName, diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js index 8d172d32abc..c924a3c6236 100644 --- a/packages/react-native-codegen/src/generators/modules/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -11,11 +11,11 @@ 'use strict'; import type { - SchemaType, NativeModuleAliasMap, + NativeModuleEnumMembers, NativeModuleObjectTypeAnnotation, NativeModuleSchema, - NativeModuleEnumMembers, + SchemaType, } from '../../CodegenSchema'; const invariant = require('invariant'); diff --git a/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js b/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js index 36eafbe5884..12d42258b98 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/error-utils-test.js @@ -15,42 +15,41 @@ const { throwIfConfigNotfound, throwIfMoreThanOneConfig, } = require('../error-utils'); - const { - throwIfModuleInterfaceNotFound, - throwIfMoreThanOneModuleRegistryCalls, - throwIfModuleInterfaceIsMisnamed, - throwIfUnusedModuleInterfaceParserError, - throwIfWrongNumberOfCallExpressionArgs, - throwIfIncorrectModuleRegistryCallTypeParameterParserError, - throwIfIncorrectModuleRegistryCallArgument, - throwIfUnsupportedFunctionReturnTypeAnnotationParserError, - throwIfMoreThanOneModuleInterfaceParserError, - throwIfModuleTypeIsUnsupported, - throwIfUntypedModule, - throwIfUnsupportedFunctionParamTypeAnnotationParserError, + throwIfArgumentPropsAreNull, throwIfArrayElementTypeAnnotationIsUnsupported, + throwIfBubblingTypeIsNull, + throwIfEventHasNoName, + throwIfIncorrectModuleRegistryCallArgument, + throwIfIncorrectModuleRegistryCallTypeParameterParserError, + throwIfModuleInterfaceIsMisnamed, + throwIfModuleInterfaceNotFound, + throwIfModuleTypeIsUnsupported, + throwIfMoreThanOneCodegenNativecommands, + throwIfMoreThanOneModuleInterfaceParserError, + throwIfMoreThanOneModuleRegistryCalls, throwIfPartialNotAnnotatingTypeParameter, throwIfPartialWithMoreParameter, - throwIfMoreThanOneCodegenNativecommands, - throwIfEventHasNoName, - throwIfBubblingTypeIsNull, - throwIfArgumentPropsAreNull, throwIfTypeAliasIsNotInterface, + throwIfUnsupportedFunctionParamTypeAnnotationParserError, + throwIfUnsupportedFunctionReturnTypeAnnotationParserError, + throwIfUntypedModule, + throwIfUnusedModuleInterfaceParserError, + throwIfWrongNumberOfCallExpressionArgs, } = require('../error-utils'); const { - UnsupportedModulePropertyParserError, - ModuleInterfaceNotFoundParserError, - MoreThanOneModuleRegistryCallsParserError, - MisnamedModuleInterfaceParserError, - UnusedModuleInterfaceParserError, + IncorrectModuleRegistryCallArgumentTypeParserError, IncorrectModuleRegistryCallArityParserError, IncorrectModuleRegistryCallTypeParameterParserError, - IncorrectModuleRegistryCallArgumentTypeParserError, - UnsupportedFunctionReturnTypeAnnotationParserError, - UntypedModuleRegistryCallParserError, + MisnamedModuleInterfaceParserError, + ModuleInterfaceNotFoundParserError, MoreThanOneModuleInterfaceParserError, + MoreThanOneModuleRegistryCallsParserError, UnsupportedFunctionParamTypeAnnotationParserError, + UnsupportedFunctionReturnTypeAnnotationParserError, + UnsupportedModulePropertyParserError, + UntypedModuleRegistryCallParserError, + UnusedModuleInterfaceParserError, } = require('../errors'); const {FlowParser} = require('../flow/parser'); const {TypeScriptParser} = require('../typescript/parser'); diff --git a/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js b/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js index fce3fcb9138..d2870f40d13 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/parsers-commons-test.js @@ -11,56 +11,54 @@ 'use-strict'; -import { - assertGenericTypeAnnotationHasExactlyOneTypeParameter, - isObjectProperty, - parseObjectProperty, - wrapNullable, - unwrapNullable, - buildSchemaFromConfigType, - buildSchema, - parseModuleName, - createComponentConfig, - propertyNames, - getCommandOptions, - getOptions, - getCommandTypeNameAndOptionsExpression, - getTypeResolutionStatus, - handleGenericTypeAnnotation, -} from '../parsers-commons'; import type {ParserType} from '../errors'; -const {Visitor} = require('../parsers-primitives'); -const {wrapComponentSchema} = require('../schema.js'); -const {buildComponentSchema} = require('../flow/components'); -const {buildModuleSchema} = require('../parsers-commons.js'); +import {FlowParser} from '../flow/parser'; +import {MockedParser} from '../parserMock'; +import { + assertGenericTypeAnnotationHasExactlyOneTypeParameter, + buildSchema, + buildSchemaFromConfigType, + createComponentConfig, + getCommandOptions, + getCommandTypeNameAndOptionsExpression, + getOptions, + getTypeResolutionStatus, + handleGenericTypeAnnotation, + isObjectProperty, + parseModuleName, + parseObjectProperty, + propertyNames, + unwrapNullable, + wrapNullable, +} from '../parsers-commons'; + const { - isModuleRegistryCall, - createParserErrorCapturer, -} = require('../utils.js'); -const { - ParserError, - UnsupportedObjectPropertyTypeAnnotationParserError, - UnusedModuleInterfaceParserError, - MoreThanOneModuleRegistryCallsParserError, - IncorrectModuleRegistryCallArityParserError, IncorrectModuleRegistryCallArgumentTypeParserError, - UntypedModuleRegistryCallParserError, + IncorrectModuleRegistryCallArityParserError, + MisnamedModuleInterfaceParserError, ModuleInterfaceNotFoundParserError, MoreThanOneModuleInterfaceParserError, - MisnamedModuleInterfaceParserError, + MoreThanOneModuleRegistryCallsParserError, + ParserError, + UnsupportedObjectPropertyTypeAnnotationParserError, + UntypedModuleRegistryCallParserError, + UnusedModuleInterfaceParserError, } = require('../errors'); - -import {MockedParser} from '../parserMock'; -import {FlowParser} from '../flow/parser'; +const {buildComponentSchema} = require('../flow/components'); +const {flowTranslateTypeAnnotation} = require('../flow/modules/index'); +const {buildModuleSchema} = require('../parsers-commons.js'); +const {Visitor} = require('../parsers-primitives'); +const {wrapComponentSchema} = require('../schema.js'); +const typeScriptTranslateTypeAnnotation = require('../typescript/modules/index'); +const { + createParserErrorCapturer, + isModuleRegistryCall, +} = require('../utils.js'); const parser = new MockedParser(); - const flowParser = new FlowParser(); -const {flowTranslateTypeAnnotation} = require('../flow/modules/index'); -const typeScriptTranslateTypeAnnotation = require('../typescript/modules/index'); - beforeEach(() => { jest.clearAllMocks(); }); diff --git a/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js b/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js index 770f78a04b3..02aa6b3a535 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js @@ -17,40 +17,40 @@ import type { UnionTypeAnnotationMemberType, } from '../../CodegenSchema'; +const {UnsupportedUnionTypeAnnotationParserError} = require('../errors'); +const {extractArrayElementType} = require('../flow/components/events'); +const {FlowParser} = require('../flow/parser'); +const {MockedParser} = require('../parserMock'); +const {emitUnion} = require('../parsers-primitives'); const { + Visitor, emitArrayType, emitBoolean, emitBoolProp, + emitCommonTypes, emitDouble, emitDoubleProp, emitFloat, emitFloatProp, - emitNumber, + emitGenericObject, emitInt32, emitInt32Prop, - emitGenericObject, + emitMixed, + emitNumber, emitObject, + emitObjectProp, + emitPartial, emitPromise, emitRootTag, - emitVoid, emitString, emitStringish, - emitMixed, - emitPartial, - emitCommonTypes, + emitStringProp, + emitUnionProp, + emitVoid, typeAliasResolution, typeEnumResolution, - Visitor, - emitStringProp, - emitObjectProp, - emitUnionProp, } = require('../parsers-primitives.js'); -const {MockedParser} = require('../parserMock'); -const {emitUnion} = require('../parsers-primitives'); -const {UnsupportedUnionTypeAnnotationParserError} = require('../errors'); -const {FlowParser} = require('../flow/parser'); const {TypeScriptParser} = require('../typescript/parser'); -const {extractArrayElementType} = require('../flow/components/events'); const parser = new MockedParser(); const flowParser = new FlowParser(); diff --git a/packages/react-native-codegen/src/parsers/__tests__/parsers-test.js b/packages/react-native-codegen/src/parsers/__tests__/parsers-test.js index 32eef3dcf5c..41014b87506 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/parsers-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/parsers-test.js @@ -11,13 +11,13 @@ 'use-strict'; +import {FlowParser} from '../flow/parser'; +import {TypeScriptParser} from '../typescript/parser'; + const { UnsupportedObjectPropertyTypeAnnotationParserError, } = require('../errors'); -import {TypeScriptParser} from '../typescript/parser'; -import {FlowParser} from '../flow/parser'; - const hasteModuleName = 'moduleName'; describe('FlowParser', () => { const parser = new FlowParser(); diff --git a/packages/react-native-codegen/src/parsers/__tests__/utils-test.js b/packages/react-native-codegen/src/parsers/__tests__/utils-test.js index 65b681bc736..31b396be361 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/utils-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/utils-test.js @@ -11,13 +11,13 @@ 'use strict'; +const {ParserError} = require('../errors'); const { - extractNativeModuleName, createParserErrorCapturer, + extractNativeModuleName, verifyPlatforms, visit, } = require('../utils.js'); -const {ParserError} = require('../errors'); beforeEach(() => { jest.clearAllMocks(); diff --git a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js index b06dd17789c..907de44d7d3 100644 --- a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js +++ b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkComponentSnaps-test.js @@ -10,13 +10,13 @@ 'use strict'; +const flowSnaps = require('../../../../src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap'); +const tsSnaps = require('../../../../src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap'); +const flowFixtures = require('../../flow/components/__test_fixtures__/fixtures.js'); +const tsFixtures = require('../../typescript/components/__test_fixtures__/fixtures.js'); const {compareSnaps, compareTsArraySnaps} = require('../compareSnaps.js'); -const flowFixtures = require('../../flow/components/__test_fixtures__/fixtures.js'); -const flowSnaps = require('../../../../src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap'); const flowExtraCases = []; -const tsFixtures = require('../../typescript/components/__test_fixtures__/fixtures.js'); -const tsSnaps = require('../../../../src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap'); const tsExtraCases = [ 'ARRAY2_PROP_TYPES_NO_EVENTS', 'PROPS_AND_EVENTS_WITH_INTERFACES', diff --git a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkModuleSnaps-test.js b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkModuleSnaps-test.js index 1e1fe3909c1..846598b4679 100644 --- a/packages/react-native-codegen/src/parsers/consistency/__tests__/checkModuleSnaps-test.js +++ b/packages/react-native-codegen/src/parsers/consistency/__tests__/checkModuleSnaps-test.js @@ -10,13 +10,13 @@ 'use strict'; +const flowSnaps = require('../../../../src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap'); +const tsSnaps = require('../../../../src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap'); +const flowFixtures = require('../../flow/modules/__test_fixtures__/fixtures.js'); +const tsFixtures = require('../../typescript/modules/__test_fixtures__/fixtures.js'); const {compareSnaps, compareTsArraySnaps} = require('../compareSnaps.js'); -const flowFixtures = require('../../flow/modules/__test_fixtures__/fixtures.js'); -const flowSnaps = require('../../../../src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap'); const flowExtraCases = ['PROMISE_WITH_COMMONLY_USED_TYPES']; -const tsFixtures = require('../../typescript/modules/__test_fixtures__/fixtures.js'); -const tsSnaps = require('../../../../src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap'); const tsExtraCases = [ 'NATIVE_MODULE_WITH_ARRAY2_WITH_ALIAS', 'NATIVE_MODULE_WITH_ARRAY2_WITH_UNION_AND_TOUPLE', diff --git a/packages/react-native-codegen/src/parsers/error-utils.js b/packages/react-native-codegen/src/parsers/error-utils.js index 1fedbe25299..eb11370bd00 100644 --- a/packages/react-native-codegen/src/parsers/error-utils.js +++ b/packages/react-native-codegen/src/parsers/error-utils.js @@ -11,25 +11,25 @@ 'use strict'; import type {NativeModuleTypeAnnotation} from '../CodegenSchema'; +import type {TypeDeclarationMap} from '../parsers/utils'; import type {ParserType} from './errors'; import type {Parser} from './parser'; -import type {TypeDeclarationMap} from '../parsers/utils'; const { - MisnamedModuleInterfaceParserError, - UnsupportedFunctionReturnTypeAnnotationParserError, - ModuleInterfaceNotFoundParserError, - MoreThanOneModuleRegistryCallsParserError, - UnusedModuleInterfaceParserError, + IncorrectModuleRegistryCallArgumentTypeParserError, IncorrectModuleRegistryCallArityParserError, IncorrectModuleRegistryCallTypeParameterParserError, - IncorrectModuleRegistryCallArgumentTypeParserError, + MisnamedModuleInterfaceParserError, + ModuleInterfaceNotFoundParserError, + MoreThanOneModuleInterfaceParserError, + MoreThanOneModuleRegistryCallsParserError, + UnsupportedArrayElementTypeAnnotationParserError, + UnsupportedFunctionParamTypeAnnotationParserError, + UnsupportedFunctionReturnTypeAnnotationParserError, + UnsupportedModulePropertyParserError, UnsupportedObjectPropertyValueTypeAnnotationParserError, UntypedModuleRegistryCallParserError, - UnsupportedModulePropertyParserError, - MoreThanOneModuleInterfaceParserError, - UnsupportedFunctionParamTypeAnnotationParserError, - UnsupportedArrayElementTypeAnnotationParserError, + UnusedModuleInterfaceParserError, } = require('./errors'); function throwIfModuleInterfaceIsMisnamed( diff --git a/packages/react-native-codegen/src/parsers/errors.js b/packages/react-native-codegen/src/parsers/errors.js index b0e42ecad95..982accfb70b 100644 --- a/packages/react-native-codegen/src/parsers/errors.js +++ b/packages/react-native-codegen/src/parsers/errors.js @@ -11,7 +11,6 @@ 'use strict'; import type {UnionTypeAnnotationMemberType} from '../CodegenSchema'; - import type {Parser} from './parser'; export type ParserType = 'Flow' | 'TypeScript'; diff --git a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js index e01d1ade6e1..50f0dfdc556 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js @@ -11,9 +11,9 @@ 'use strict'; -const {FlowParser} = require('../../parser'); -const fixtures = require('../__test_fixtures__/fixtures.js'); const failureFixtures = require('../__test_fixtures__/failures.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const {FlowParser} = require('../../parser'); jest.mock('fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. 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 bf789178d99..594f54345bd 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -11,8 +11,8 @@ 'use strict'; import type { - NamedShape, CommandTypeAnnotation, + NamedShape, } from '../../../CodegenSchema.js'; import type {TypeDeclarationMap} from '../../utils'; diff --git a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js index e827bcecbbd..4d6ab405eb8 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/flow/components/componentsUtils.js @@ -10,10 +10,11 @@ 'use strict'; -const {getValueFromTypes} = require('../utils.js'); -const {verifyPropNotAlreadyDefined} = require('../../parsers-commons'); -import type {TypeDeclarationMap, PropAST, ASTNode} from '../../utils'; import type {BuildSchemaFN, Parser} from '../../parser'; +import type {ASTNode, PropAST, TypeDeclarationMap} from '../../utils'; + +const {verifyPropNotAlreadyDefined} = require('../../parsers-commons'); +const {getValueFromTypes} = require('../utils.js'); // $FlowFixMe[unsupported-variance-annotation] function getTypeAnnotationForArray<+T>( diff --git a/packages/react-native-codegen/src/parsers/flow/components/events.js b/packages/react-native-codegen/src/parsers/flow/components/events.js index 17b3c933b32..940706e086c 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/events.js +++ b/packages/react-native-codegen/src/parsers/flow/components/events.js @@ -11,32 +11,32 @@ 'use strict'; import type { + EventTypeAnnotation, EventTypeShape, NamedShape, - EventTypeAnnotation, } from '../../../CodegenSchema.js'; import type {Parser} from '../../parser'; import type {EventArgumentReturnType} from '../../parsers-commons'; const { - throwIfEventHasNoName, - throwIfBubblingTypeIsNull, throwIfArgumentPropsAreNull, + throwIfBubblingTypeIsNull, + throwIfEventHasNoName, } = require('../../error-utils'); const { - getEventArgument, buildPropertiesForEvent, - handleEventHandler, emitBuildEventSchema, + getEventArgument, + handleEventHandler, } = require('../../parsers-commons'); const { emitBoolProp, emitDoubleProp, emitFloatProp, - emitMixedProp, - emitStringProp, emitInt32Prop, + emitMixedProp, emitObjectProp, + emitStringProp, emitUnionProp, } = require('../../parsers-primitives'); diff --git a/packages/react-native-codegen/src/parsers/flow/components/index.js b/packages/react-native-codegen/src/parsers/flow/components/index.js index 9b7acbba208..0cae27b0607 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/index.js +++ b/packages/react-native-codegen/src/parsers/flow/components/index.js @@ -12,13 +12,13 @@ import type {Parser} from '../../parser'; import type {ComponentSchemaBuilderConfig} from '../../schema.js'; -const {getCommands} = require('./commands'); -const {getEvents} = require('./events'); const { - getOptions, findComponentConfig, getCommandProperties, + getOptions, } = require('../../parsers-commons'); +const {getCommands} = require('./commands'); +const {getEvents} = require('./events'); // $FlowFixMe[signature-verification-failure] there's no flowtype for AST function buildComponentSchema( diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js index 6cda41648a0..6f5c7243175 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js @@ -9,22 +9,21 @@ */ import type { - NativeModuleReturnTypeAnnotation, NativeModuleBaseTypeAnnotation, - NativeModuleSchema, NativeModuleParamTypeAnnotation, + NativeModuleReturnTypeAnnotation, + NativeModuleSchema, } from '../../../../CodegenSchema'; -const invariant = require('invariant'); - -const {unwrapNullable} = require('../../../parsers-commons'); const { + MissingTypeParameterGenericParserError, + UnnamedFunctionParamParserError, UnsupportedGenericParserError, UnsupportedTypeAnnotationParserError, - UnnamedFunctionParamParserError, - MissingTypeParameterGenericParserError, } = require('../../../errors'); +const {unwrapNullable} = require('../../../parsers-commons'); const {FlowParser} = require('../../parser'); +const invariant = require('invariant'); const flowParser = new FlowParser(); diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js index ec20817c2bf..0fb4e8a15e6 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js @@ -11,10 +11,9 @@ 'use strict'; -const {FlowParser} = require('../../parser'); - -const fixtures = require('../__test_fixtures__/fixtures.js'); const failureFixtures = require('../__test_fixtures__/failures.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const {FlowParser} = require('../../parser'); const flowParser = new FlowParser(); diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index c50c45f2d69..99550b2da02 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -13,38 +13,36 @@ import type { NamedShape, NativeModuleAliasMap, - NativeModuleEnumMap, NativeModuleBaseTypeAnnotation, + NativeModuleEnumMap, NativeModuleTypeAnnotation, Nullable, } from '../../../CodegenSchema'; - import type {Parser} from '../../parser'; import type {ParserErrorCapturer, TypeDeclarationMap} from '../../utils'; const { - unwrapNullable, - wrapNullable, + UnsupportedGenericParserError, + UnsupportedTypeAnnotationParserError, +} = require('../../errors'); +const { assertGenericTypeAnnotationHasExactlyOneTypeParameter, parseObjectProperty, + unwrapNullable, + wrapNullable, } = require('../../parsers-commons'); const { emitArrayType, - emitFunction, + emitCommonTypes, emitDictionary, + emitFunction, emitPromise, emitRootTag, emitUnion, - emitCommonTypes, typeAliasResolution, typeEnumResolution, } = require('../../parsers-primitives'); -const { - UnsupportedTypeAnnotationParserError, - UnsupportedGenericParserError, -} = require('../../errors'); - function translateTypeAnnotation( hasteModuleName: string, /** diff --git a/packages/react-native-codegen/src/parsers/flow/parser.js b/packages/react-native-codegen/src/parsers/flow/parser.js index b0d1f2df2b5..ea19d347184 100644 --- a/packages/react-native-codegen/src/parsers/flow/parser.js +++ b/packages/react-native-codegen/src/parsers/flow/parser.js @@ -11,17 +11,17 @@ 'use strict'; import type { - UnionTypeAnnotationMemberType, - SchemaType, + ExtendsPropsShape, NamedShape, - Nullable, - NativeModuleParamTypeAnnotation, - NativeModuleEnumMemberType, - NativeModuleEnumMembers, NativeModuleAliasMap, NativeModuleEnumMap, + NativeModuleEnumMembers, + NativeModuleEnumMemberType, + NativeModuleParamTypeAnnotation, + Nullable, PropTypeAnnotation, - ExtendsPropsShape, + SchemaType, + UnionTypeAnnotationMemberType, } from '../../CodegenSchema'; import type {ParserType} from '../errors'; import type { @@ -32,45 +32,39 @@ import type { } from '../parser'; import type { ParserErrorCapturer, - TypeDeclarationMap, PropAST, + TypeDeclarationMap, TypeResolutionStatus, } from '../utils'; +const { + UnsupportedObjectPropertyTypeAnnotationParserError, +} = require('../errors'); +const { + buildModuleSchema, + buildPropSchema, + buildSchema, + handleGenericTypeAnnotation, +} = require('../parsers-commons'); +const {Visitor} = require('../parsers-primitives'); +const {wrapComponentSchema} = require('../schema.js'); +const {buildComponentSchema} = require('./components'); +const { + flattenProperties, + getSchemaInfo, + getTypeAnnotation, +} = require('./components/componentsUtils'); +const {flowTranslateTypeAnnotation} = require('./modules'); +// $FlowFixMe[untyped-import] there's no flowtype flow-parser +const flowParser = require('flow-parser'); +const fs = require('fs'); +const invariant = require('invariant'); + type ExtendsForProp = null | { type: 'ReactNativeBuiltInType', knownTypeName: 'ReactNativeCoreViewProps', }; -const invariant = require('invariant'); - -const { - getSchemaInfo, - getTypeAnnotation, - flattenProperties, -} = require('./components/componentsUtils'); - -const {flowTranslateTypeAnnotation} = require('./modules'); - -// $FlowFixMe[untyped-import] there's no flowtype flow-parser -const flowParser = require('flow-parser'); - -const { - buildSchema, - buildPropSchema, - buildModuleSchema, - handleGenericTypeAnnotation, -} = require('../parsers-commons'); -const {Visitor} = require('../parsers-primitives'); -const {buildComponentSchema} = require('./components'); -const {wrapComponentSchema} = require('../schema.js'); - -const fs = require('fs'); - -const { - UnsupportedObjectPropertyTypeAnnotationParserError, -} = require('../errors'); - class FlowParser implements Parser { typeParameterInstantiation: string = 'TypeParameterInstantiation'; typeAlias: string = 'TypeAlias'; diff --git a/packages/react-native-codegen/src/parsers/flow/utils.js b/packages/react-native-codegen/src/parsers/flow/utils.js index 73e71760df4..02af5916606 100644 --- a/packages/react-native-codegen/src/parsers/flow/utils.js +++ b/packages/react-native-codegen/src/parsers/flow/utils.js @@ -10,7 +10,7 @@ 'use strict'; -import type {TypeDeclarationMap, ASTNode} from '../utils'; +import type {ASTNode, TypeDeclarationMap} from '../utils'; function getValueFromTypes(value: ASTNode, types: TypeDeclarationMap): ASTNode { if (value.type === 'GenericTypeAnnotation' && types[value.id.name]) { diff --git a/packages/react-native-codegen/src/parsers/parser.js b/packages/react-native-codegen/src/parsers/parser.js index 7835107642d..1d1692d6617 100644 --- a/packages/react-native-codegen/src/parsers/parser.js +++ b/packages/react-native-codegen/src/parsers/parser.js @@ -11,24 +11,24 @@ 'use strict'; import type { - UnionTypeAnnotationMemberType, - SchemaType, + ExtendsPropsShape, NamedShape, - Nullable, - NativeModuleParamTypeAnnotation, - NativeModuleEnumMemberType, - NativeModuleEnumMembers, NativeModuleAliasMap, NativeModuleEnumMap, + NativeModuleEnumMembers, + NativeModuleEnumMemberType, + NativeModuleParamTypeAnnotation, + Nullable, PropTypeAnnotation, - ExtendsPropsShape, + SchemaType, + UnionTypeAnnotationMemberType, } from '../CodegenSchema'; import type {ParserType} from './errors'; import type { - ParserErrorCapturer, - TypeDeclarationMap, - PropAST, ASTNode, + ParserErrorCapturer, + PropAST, + TypeDeclarationMap, TypeResolutionStatus, } from './utils'; diff --git a/packages/react-native-codegen/src/parsers/parserMock.js b/packages/react-native-codegen/src/parsers/parserMock.js index 1a775b3079c..545e2d3559f 100644 --- a/packages/react-native-codegen/src/parsers/parserMock.js +++ b/packages/react-native-codegen/src/parsers/parserMock.js @@ -10,47 +10,47 @@ 'use strict'; +import type { + ExtendsPropsShape, + NamedShape, + NativeModuleAliasMap, + NativeModuleEnumMap, + NativeModuleEnumMembers, + NativeModuleEnumMemberType, + NativeModuleParamTypeAnnotation, + Nullable, + PropTypeAnnotation, + SchemaType, + UnionTypeAnnotationMemberType, +} from '../CodegenSchema'; +import type {ParserType} from './errors'; import type { GetSchemaInfoFN, GetTypeAnnotationFN, Parser, ResolveTypeAnnotationFN, } from './parser'; -import type {ParserType} from './errors'; -type ExtendsForProp = null | { - type: 'ReactNativeBuiltInType', - knownTypeName: 'ReactNativeCoreViewProps', -}; -import type { - UnionTypeAnnotationMemberType, - SchemaType, - NamedShape, - Nullable, - NativeModuleParamTypeAnnotation, - NativeModuleEnumMemberType, - NativeModuleEnumMembers, - NativeModuleAliasMap, - NativeModuleEnumMap, - PropTypeAnnotation, - ExtendsPropsShape, -} from '../CodegenSchema'; import type { ParserErrorCapturer, PropAST, TypeDeclarationMap, TypeResolutionStatus, } from './utils'; + import invariant from 'invariant'; -const {flattenProperties} = require('./typescript/components/componentsUtils'); - -const {buildPropSchema} = require('./parsers-commons'); - -// $FlowFixMe[untyped-import] there's no flowtype flow-parser -const flowParser = require('flow-parser'); const { UnsupportedObjectPropertyTypeAnnotationParserError, } = require('./errors'); +const {buildPropSchema} = require('./parsers-commons'); +const {flattenProperties} = require('./typescript/components/componentsUtils'); +// $FlowFixMe[untyped-import] there's no flowtype flow-parser +const flowParser = require('flow-parser'); + +type ExtendsForProp = null | { + type: 'ReactNativeBuiltInType', + knownTypeName: 'ReactNativeCoreViewProps', +}; const schemaMock = { modules: { diff --git a/packages/react-native-codegen/src/parsers/parsers-commons.js b/packages/react-native-codegen/src/parsers/parsers-commons.js index 371bbf08edd..b3b34b7de06 100644 --- a/packages/react-native-codegen/src/parsers/parsers-commons.js +++ b/packages/react-native-codegen/src/parsers/parsers-commons.js @@ -11,69 +11,65 @@ 'use strict'; import type { - Nullable, + EventTypeAnnotation, + EventTypeShape, NamedShape, NativeModuleAliasMap, NativeModuleBaseTypeAnnotation, - NativeModuleSchema, - NativeModuleTypeAnnotation, + NativeModuleEnumMap, NativeModuleFunctionTypeAnnotation, NativeModuleParamTypeAnnotation, NativeModulePropertyShape, - SchemaType, - NativeModuleEnumMap, + NativeModuleSchema, + NativeModuleTypeAnnotation, + Nullable, + ObjectTypeAnnotation, OptionsShape, PropTypeAnnotation, - EventTypeAnnotation, - ObjectTypeAnnotation, - EventTypeShape, + SchemaType, } from '../CodegenSchema.js'; - -import type {Parser} from './parser'; import type {ParserType} from './errors'; +import type {Parser} from './parser'; +import type {ComponentSchemaBuilderConfig} from './schema.js'; import type { ParserErrorCapturer, - TypeDeclarationMap, PropAST, + TypeDeclarationMap, TypeResolutionStatus, } from './utils'; -import type {ComponentSchemaBuilderConfig} from './schema.js'; - -const { - getConfigType, - extractNativeModuleName, - createParserErrorCapturer, - visit, - isModuleRegistryCall, - verifyPlatforms, -} = require('./utils'); const { + throwIfConfigNotfound, + throwIfIncorrectModuleRegistryCallArgument, + throwIfIncorrectModuleRegistryCallTypeParameterParserError, + throwIfModuleInterfaceIsMisnamed, + throwIfModuleInterfaceNotFound, + throwIfModuleTypeIsUnsupported, + throwIfMoreThanOneCodegenNativecommands, + throwIfMoreThanOneConfig, + throwIfMoreThanOneModuleInterfaceParserError, + throwIfMoreThanOneModuleRegistryCalls, throwIfPropertyValueTypeIsUnsupported, + throwIfTypeAliasIsNotInterface, throwIfUnsupportedFunctionParamTypeAnnotationParserError, throwIfUnsupportedFunctionReturnTypeAnnotationParserError, - throwIfModuleTypeIsUnsupported, - throwIfUnusedModuleInterfaceParserError, - throwIfMoreThanOneModuleRegistryCalls, - throwIfWrongNumberOfCallExpressionArgs, throwIfUntypedModule, - throwIfIncorrectModuleRegistryCallTypeParameterParserError, - throwIfIncorrectModuleRegistryCallArgument, - throwIfModuleInterfaceNotFound, - throwIfMoreThanOneModuleInterfaceParserError, - throwIfModuleInterfaceIsMisnamed, - throwIfMoreThanOneCodegenNativecommands, - throwIfConfigNotfound, - throwIfMoreThanOneConfig, - throwIfTypeAliasIsNotInterface, + throwIfUnusedModuleInterfaceParserError, + throwIfWrongNumberOfCallExpressionArgs, } = require('./error-utils'); - const { MissingTypeParameterGenericParserError, MoreThanOneTypeParameterGenericParserError, UnnamedFunctionParamParserError, } = require('./errors'); - +const { + createParserErrorCapturer, + extractNativeModuleName, + getConfigType, + isModuleRegistryCall, + verifyPlatforms, + visit, +} = require('./utils'); const invariant = require('invariant'); export type CommandOptions = $ReadOnly<{ diff --git a/packages/react-native-codegen/src/parsers/parsers-primitives.js b/packages/react-native-codegen/src/parsers/parsers-primitives.js index e632570db09..dbc2c564cc4 100644 --- a/packages/react-native-codegen/src/parsers/parsers-primitives.js +++ b/packages/react-native-codegen/src/parsers/parsers-primitives.js @@ -11,57 +11,55 @@ 'use strict'; import type { - Nullable, BooleanTypeAnnotation, DoubleTypeAnnotation, EventTypeAnnotation, Int32TypeAnnotation, NamedShape, NativeModuleAliasMap, - NativeModuleEnumMap, NativeModuleBaseTypeAnnotation, - NativeModuleTypeAnnotation, + NativeModuleEnumDeclaration, + NativeModuleEnumMap, NativeModuleFloatTypeAnnotation, NativeModuleFunctionTypeAnnotation, NativeModuleGenericObjectTypeAnnotation, NativeModuleMixedTypeAnnotation, NativeModuleNumberTypeAnnotation, + NativeModuleObjectTypeAnnotation, NativeModulePromiseTypeAnnotation, NativeModuleTypeAliasTypeAnnotation, + NativeModuleTypeAnnotation, NativeModuleUnionTypeAnnotation, + Nullable, ObjectTypeAnnotation, ReservedTypeAnnotation, StringTypeAnnotation, VoidTypeAnnotation, - NativeModuleObjectTypeAnnotation, - NativeModuleEnumDeclaration, } from '../CodegenSchema'; import type {Parser} from './parser'; import type { ParserErrorCapturer, - TypeResolutionStatus, TypeDeclarationMap, + TypeResolutionStatus, } from './utils'; -const { - UnsupportedUnionTypeAnnotationParserError, - UnsupportedTypeAnnotationParserError, - ParserError, -} = require('./errors'); - const { throwIfArrayElementTypeAnnotationIsUnsupported, throwIfPartialNotAnnotatingTypeParameter, throwIfPartialWithMoreParameter, } = require('./error-utils'); -const {nullGuard} = require('./parsers-utils'); +const { + ParserError, + UnsupportedTypeAnnotationParserError, + UnsupportedUnionTypeAnnotationParserError, +} = require('./errors'); const { assertGenericTypeAnnotationHasExactlyOneTypeParameter, - wrapNullable, - unwrapNullable, translateFunctionTypeAnnotation, + unwrapNullable, + wrapNullable, } = require('./parsers-commons'); - +const {nullGuard} = require('./parsers-utils'); const {isModuleRegistryCall} = require('./utils'); function emitBoolean(nullable: boolean): Nullable { diff --git a/packages/react-native-codegen/src/parsers/schema.js b/packages/react-native-codegen/src/parsers/schema.js index 0fdf3c37511..2ebf6158b2d 100644 --- a/packages/react-native-codegen/src/parsers/schema.js +++ b/packages/react-native-codegen/src/parsers/schema.js @@ -11,13 +11,13 @@ 'use strict'; import type { - EventTypeShape, - NamedShape, CommandTypeAnnotation, - PropTypeAnnotation, + EventTypeShape, ExtendsPropsShape, - SchemaType, + NamedShape, OptionsShape, + PropTypeAnnotation, + SchemaType, } from '../CodegenSchema.js'; export type ComponentSchemaBuilderConfig = $ReadOnly<{ diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js index dd56de0b135..cd31e4f4d71 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js @@ -11,9 +11,9 @@ 'use strict'; -const {TypeScriptParser} = require('../../parser'); -const fixtures = require('../__test_fixtures__/fixtures.js'); const failureFixtures = require('../__test_fixtures__/failures.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const {TypeScriptParser} = require('../../parser'); jest.mock('fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. 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 390a6d71b96..5d04d9e77ec 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -11,10 +11,11 @@ 'use strict'; import type { - NamedShape, CommandTypeAnnotation, + NamedShape, } from '../../../CodegenSchema.js'; import type {TypeDeclarationMap} from '../../utils'; + const {parseTopLevelType} = require('../parseTopLevelType'); // $FlowFixMe[unclear-type] there's no flowtype for ASTs 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 bbe56a973e5..79fd8db4332 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -9,13 +9,14 @@ */ 'use strict'; -const { - parseTopLevelType, - flattenIntersectionType, -} = require('../parseTopLevelType'); -const {verifyPropNotAlreadyDefined} = require('../../parsers-commons'); -import type {TypeDeclarationMap, PropAST, ASTNode} from '../../utils'; import type {BuildSchemaFN, Parser} from '../../parser'; +import type {ASTNode, PropAST, TypeDeclarationMap} from '../../utils'; + +const {verifyPropNotAlreadyDefined} = require('../../parsers-commons'); +const { + flattenIntersectionType, + parseTopLevelType, +} = require('../parseTopLevelType'); function getUnionOfLiterals( name: string, diff --git a/packages/react-native-codegen/src/parsers/typescript/components/events.js b/packages/react-native-codegen/src/parsers/typescript/components/events.js index 0be6d104d58..a0672ac3570 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/events.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/events.js @@ -11,35 +11,36 @@ 'use strict'; import type { + EventTypeAnnotation, EventTypeShape, NamedShape, - EventTypeAnnotation, } from '../../../CodegenSchema.js'; -import type {TypeDeclarationMap} from '../../utils'; import type {Parser} from '../../parser'; -const {flattenProperties} = require('./componentsUtils'); -const {parseTopLevelType} = require('../parseTopLevelType'); +import type {TypeDeclarationMap} from '../../utils'; + const { - throwIfEventHasNoName, - throwIfBubblingTypeIsNull, throwIfArgumentPropsAreNull, + throwIfBubblingTypeIsNull, + throwIfEventHasNoName, } = require('../../error-utils'); const { - getEventArgument, buildPropertiesForEvent, - handleEventHandler, emitBuildEventSchema, + getEventArgument, + handleEventHandler, } = require('../../parsers-commons'); const { emitBoolProp, emitDoubleProp, emitFloatProp, - emitMixedProp, - emitStringProp, emitInt32Prop, + emitMixedProp, emitObjectProp, + emitStringProp, emitUnionProp, } = require('../../parsers-primitives'); +const {parseTopLevelType} = require('../parseTopLevelType'); +const {flattenProperties} = require('./componentsUtils'); function getPropertyType( /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ diff --git a/packages/react-native-codegen/src/parsers/typescript/components/extends.js b/packages/react-native-codegen/src/parsers/typescript/components/extends.js index fa0ed221a95..6e29af9caf1 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/extends.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/extends.js @@ -11,6 +11,7 @@ 'use strict'; import type {TypeDeclarationMap} from '../../utils'; + const {parseTopLevelType} = require('../parseTopLevelType'); function isEvent(typeAnnotation: $FlowFixMe): boolean { diff --git a/packages/react-native-codegen/src/parsers/typescript/components/index.js b/packages/react-native-codegen/src/parsers/typescript/components/index.js index 4d3523c6a19..fa95c8f7e41 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/index.js @@ -12,14 +12,14 @@ import type {Parser} from '../../parser'; import type {ComponentSchemaBuilderConfig} from '../../schema.js'; +const { + findComponentConfig, + getCommandProperties, + getOptions, +} = require('../../parsers-commons'); const {getCommands} = require('./commands'); const {getEvents} = require('./events'); const {categorizeProps} = require('./extends'); -const { - getOptions, - findComponentConfig, - getCommandProperties, -} = require('../../parsers-commons'); // $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser type PropsAST = Object; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js index 04b471ac808..58b9444b46e 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js @@ -9,22 +9,21 @@ */ import type { - NativeModuleReturnTypeAnnotation, NativeModuleBaseTypeAnnotation, - NativeModuleSchema, NativeModuleParamTypeAnnotation, + NativeModuleReturnTypeAnnotation, + NativeModuleSchema, } from '../../../../CodegenSchema'; -const invariant = require('invariant'); - -const {unwrapNullable} = require('../../../parsers-commons'); const { + MissingTypeParameterGenericParserError, + UnnamedFunctionParamParserError, UnsupportedGenericParserError, UnsupportedTypeAnnotationParserError, - UnnamedFunctionParamParserError, - MissingTypeParameterGenericParserError, } = require('../../../errors'); +const {unwrapNullable} = require('../../../parsers-commons'); const {TypeScriptParser} = require('../../parser'); +const invariant = require('invariant'); const typescriptParser = new TypeScriptParser(); diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js index 68b1e694dbf..d375d0bbae9 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js @@ -11,10 +11,9 @@ 'use strict'; -const {TypeScriptParser} = require('../../parser'); - -const fixtures = require('../__test_fixtures__/fixtures.js'); const failureFixtures = require('../__test_fixtures__/failures.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const {TypeScriptParser} = require('../../parser'); const typeScriptParser = new TypeScriptParser(); diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/index.js b/packages/react-native-codegen/src/parsers/typescript/modules/index.js index 4668924375c..060ee2f5c23 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/index.js @@ -13,40 +13,37 @@ import type { NamedShape, NativeModuleAliasMap, - NativeModuleEnumMap, NativeModuleBaseTypeAnnotation, + NativeModuleEnumMap, NativeModuleTypeAnnotation, Nullable, } from '../../../CodegenSchema'; - import type {Parser} from '../../parser'; import type { ParserErrorCapturer, - TypeResolutionStatus, TypeDeclarationMap, + TypeResolutionStatus, } from '../../utils'; -const {flattenIntersectionType} = require('../parseTopLevelType'); -const {flattenProperties} = require('../components/componentsUtils'); - -const {parseObjectProperty} = require('../../parsers-commons'); - -const { - emitArrayType, - emitFunction, - emitDictionary, - emitPromise, - emitRootTag, - emitUnion, - emitCommonTypes, - typeAliasResolution, - typeEnumResolution, - translateArrayTypeAnnotation, -} = require('../../parsers-primitives'); const { UnsupportedGenericParserError, UnsupportedTypeAnnotationParserError, } = require('../../errors'); +const {parseObjectProperty} = require('../../parsers-commons'); +const { + emitArrayType, + emitCommonTypes, + emitDictionary, + emitFunction, + emitPromise, + emitRootTag, + emitUnion, + translateArrayTypeAnnotation, + typeAliasResolution, + typeEnumResolution, +} = require('../../parsers-primitives'); +const {flattenProperties} = require('../components/componentsUtils'); +const {flattenIntersectionType} = require('../parseTopLevelType'); function translateObjectTypeAnnotation( hasteModuleName: string, diff --git a/packages/react-native-codegen/src/parsers/typescript/parser.js b/packages/react-native-codegen/src/parsers/typescript/parser.js index 9e8dc836b4e..8fbffd03297 100644 --- a/packages/react-native-codegen/src/parsers/typescript/parser.js +++ b/packages/react-native-codegen/src/parsers/typescript/parser.js @@ -11,17 +11,17 @@ 'use strict'; import type { - UnionTypeAnnotationMemberType, - SchemaType, + ExtendsPropsShape, NamedShape, - Nullable, - NativeModuleParamTypeAnnotation, - NativeModuleEnumMembers, - NativeModuleEnumMemberType, NativeModuleAliasMap, NativeModuleEnumMap, + NativeModuleEnumMembers, + NativeModuleEnumMemberType, + NativeModuleParamTypeAnnotation, + Nullable, PropTypeAnnotation, - ExtendsPropsShape, + SchemaType, + UnionTypeAnnotationMemberType, } from '../../CodegenSchema'; import type {ParserType} from '../errors'; import type { @@ -32,39 +32,35 @@ import type { } from '../parser'; import type { ParserErrorCapturer, - TypeDeclarationMap, PropAST, + TypeDeclarationMap, TypeResolutionStatus, } from '../utils'; -const invariant = require('invariant'); - -const {typeScriptTranslateTypeAnnotation} = require('./modules'); - -// $FlowFixMe[untyped-import] Use flow-types for @babel/parser -const babelParser = require('@babel/parser'); - -const {Visitor} = require('../parsers-primitives'); -const {buildComponentSchema} = require('./components'); -const {wrapComponentSchema} = require('../schema.js'); -const { - buildSchema, - buildModuleSchema, - extendsForProp, - buildPropSchema, - handleGenericTypeAnnotation, -} = require('../parsers-commons.js'); - -const {parseTopLevelType} = require('./parseTopLevelType'); -const { - getSchemaInfo, - getTypeAnnotation, - flattenProperties, -} = require('./components/componentsUtils'); -const fs = require('fs'); const { UnsupportedObjectPropertyTypeAnnotationParserError, } = require('../errors'); +const { + buildModuleSchema, + buildPropSchema, + buildSchema, + extendsForProp, + handleGenericTypeAnnotation, +} = require('../parsers-commons.js'); +const {Visitor} = require('../parsers-primitives'); +const {wrapComponentSchema} = require('../schema.js'); +const {buildComponentSchema} = require('./components'); +const { + flattenProperties, + getSchemaInfo, + getTypeAnnotation, +} = require('./components/componentsUtils'); +const {typeScriptTranslateTypeAnnotation} = require('./modules'); +const {parseTopLevelType} = require('./parseTopLevelType'); +// $FlowFixMe[untyped-import] Use flow-types for @babel/parser +const babelParser = require('@babel/parser'); +const fs = require('fs'); +const invariant = require('invariant'); class TypeScriptParser implements Parser { typeParameterInstantiation: string = 'TSTypeParameterInstantiation'; diff --git a/packages/react-native-codegen/src/parsers/utils.js b/packages/react-native-codegen/src/parsers/utils.js index 5c904c6c80f..77d62848e4a 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -11,7 +11,6 @@ 'use strict'; const {ParserError} = require('./errors'); - const path = require('path'); export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe}; diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/IdTestModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/IdTestModule.js index 278670f3527..dab184be7f0 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/IdTestModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/IdTestModule.js @@ -11,8 +11,6 @@ 'use strict'; const React = require('react'); -const TouchableBounce = require('react-native/Libraries/Components/Touchable/TouchableBounce'); - const { Image, StyleSheet, @@ -23,6 +21,7 @@ const { TouchableWithoutFeedback, View, } = require('react-native'); +const TouchableBounce = require('react-native/Libraries/Components/Touchable/TouchableBounce'); /** * All the views implemented on Android, each with the id property set. diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js index 68289a53bee..3cc2fef702f 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js @@ -9,11 +9,11 @@ 'use strict'; +import {assertEquals} from './Asserts'; import * as React from 'react'; import {useEffect, useRef} from 'react'; import {StyleSheet, UIManager, View, findNodeHandle} from 'react-native'; import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge'; -import {assertEquals} from './Asserts'; const styles = StyleSheet.create({ A: { diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/NativeIdTestModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/NativeIdTestModule.js index 583d7c71b16..ba19338a68e 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/NativeIdTestModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/NativeIdTestModule.js @@ -11,8 +11,6 @@ 'use strict'; const React = require('react'); -const TouchableBounce = require('react-native/Libraries/Components/Touchable/TouchableBounce'); - const { Image, StyleSheet, @@ -23,6 +21,7 @@ const { TouchableWithoutFeedback, View, } = require('react-native'); +const TouchableBounce = require('react-native/Libraries/Components/Touchable/TouchableBounce'); /** * All the views implemented on Android, each with the nativeID property set. diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js index 4808118ed89..0f3948b2b29 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js @@ -15,9 +15,7 @@ import type { ScrollEvent, } from 'react-native/Libraries/Types/CoreEventTypes'; -const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); const React = require('react'); - const { NativeModules, ScrollView, @@ -26,6 +24,7 @@ const { TouchableWithoutFeedback, View, } = require('react-native'); +const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); const {ScrollListener} = NativeModules; diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/TestBundle.js b/packages/react-native/ReactAndroid/src/androidTest/js/TestBundle.js index e4c8a519e1a..6b42a2df746 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/TestBundle.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/TestBundle.js @@ -9,6 +9,8 @@ 'use strict'; +/* eslint-disable lint/sort-imports */ + const {AppRegistry} = require('react-native'); const TestApps = require('./TestApps'); diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js index 81d0f194154..ba8133b7933 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js @@ -9,8 +9,8 @@ 'use strict'; -const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); const {assertEquals, assertTrue} = require('./Asserts'); +const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); function strictStringCompare(a, b) { if (typeof a !== 'string' || typeof b !== 'string' || a.length !== b.length) { diff --git a/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js b/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js index 9d81124ba86..253209cee1e 100644 --- a/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js +++ b/packages/react-native/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js @@ -9,10 +9,9 @@ 'use strict'; +const {assertEquals, assertTrue} = require('./Asserts'); const {NativeModules} = require('react-native'); const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); - -const {assertEquals, assertTrue} = require('./Asserts'); const {TestModule} = NativeModules; const TestJavaToJSReturnValuesModule = { diff --git a/packages/react-native/cli.js b/packages/react-native/cli.js index 451c0860fc0..4d84dd6b470 100755 --- a/packages/react-native/cli.js +++ b/packages/react-native/cli.js @@ -10,12 +10,11 @@ 'use strict'; +const {version: currentVersion} = require('./package.json'); +const cli = require('@react-native-community/cli'); +const chalk = require('chalk'); const {get} = require('https'); const {URL} = require('url'); -const chalk = require('chalk'); -const cli = require('@react-native-community/cli'); - -const {version: currentVersion} = require('./package.json'); const isNpxRuntime = process.env.npm_lifecycle_event === 'npx'; const DEFAULT_REGISTRY_HOST = diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 7149c6463b5..0e4376a60f7 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -10,95 +10,92 @@ 'use strict'; +// APIs +import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS'; +import typeof Alert from './Libraries/Alert/Alert'; +import typeof Animated from './Libraries/Animated/Animated'; +import typeof * as AnimatedModule from './Libraries/Animated/Animated'; +import typeof Easing from './Libraries/Animated/Easing'; +import typeof useAnimatedValue from './Libraries/Animated/useAnimatedValue'; +import typeof AppState from './Libraries/AppState/AppState'; +import typeof NativeModules from './Libraries/BatchedBridge/NativeModules'; // Components import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator'; import typeof Button from './Libraries/Components/Button'; +import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard'; import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; -import typeof FlatList from './Libraries/Lists/FlatList'; -import typeof Image from './Libraries/Image/Image'; -import typeof ImageBackground from './Libraries/Image/ImageBackground'; -import typeof InputAccessoryView from './Libraries/Components/TextInput/InputAccessoryView'; +import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard'; import typeof KeyboardAvoidingView from './Libraries/Components/Keyboard/KeyboardAvoidingView'; -import typeof Modal from './Libraries/Modal/Modal'; import typeof Pressable from './Libraries/Components/Pressable/Pressable'; import typeof ProgressBarAndroid from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; import typeof RefreshControl from './Libraries/Components/RefreshControl/RefreshControl'; import typeof SafeAreaView from './Libraries/Components/SafeAreaView/SafeAreaView'; import typeof ScrollView from './Libraries/Components/ScrollView/ScrollView'; -import typeof SectionList from './Libraries/Lists/SectionList'; import typeof StatusBar from './Libraries/Components/StatusBar/StatusBar'; import typeof Switch from './Libraries/Components/Switch/Switch'; -import typeof Text from './Libraries/Text/Text'; +import typeof InputAccessoryView from './Libraries/Components/TextInput/InputAccessoryView'; import typeof TextInput from './Libraries/Components/TextInput/TextInput'; +import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid'; import typeof Touchable from './Libraries/Components/Touchable/Touchable'; import typeof TouchableHighlight from './Libraries/Components/Touchable/TouchableHighlight'; import typeof TouchableNativeFeedback from './Libraries/Components/Touchable/TouchableNativeFeedback'; import typeof TouchableOpacity from './Libraries/Components/Touchable/TouchableOpacity'; import typeof TouchableWithoutFeedback from './Libraries/Components/Touchable/TouchableWithoutFeedback'; import typeof View from './Libraries/Components/View/View'; +import typeof NativeEventEmitter from './Libraries/EventEmitter/NativeEventEmitter'; +import typeof RCTDeviceEventEmitter from './Libraries/EventEmitter/RCTDeviceEventEmitter'; +import typeof RCTNativeAppEventEmitter from './Libraries/EventEmitter/RCTNativeAppEventEmitter'; +import typeof Image from './Libraries/Image/Image'; +import typeof ImageBackground from './Libraries/Image/ImageBackground'; +import typeof InteractionManager from './Libraries/Interaction/InteractionManager'; +import typeof PanResponder from './Libraries/Interaction/PanResponder'; +import typeof LayoutAnimation from './Libraries/LayoutAnimation/LayoutAnimation'; +import typeof Linking from './Libraries/Linking/Linking'; +import typeof FlatList from './Libraries/Lists/FlatList'; +import typeof SectionList from './Libraries/Lists/SectionList'; import typeof VirtualizedList from './Libraries/Lists/VirtualizedList'; import typeof VirtualizedSectionList from './Libraries/Lists/VirtualizedSectionList'; - -// APIs -import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS'; -import typeof Alert from './Libraries/Alert/Alert'; -import typeof Animated from './Libraries/Animated/Animated'; -import typeof * as AnimatedModule from './Libraries/Animated/Animated'; -import typeof Appearance from './Libraries/Utilities/Appearance'; +import typeof LogBox from './Libraries/LogBox/LogBox'; +import typeof Modal from './Libraries/Modal/Modal'; +import typeof NativeDialogManagerAndroid from './Libraries/NativeModules/specs/NativeDialogManagerAndroid'; +import typeof Networking from './Libraries/Network/RCTNetworking'; +import typeof * as Systrace from './Libraries/Performance/Systrace'; +import typeof PermissionsAndroid from './Libraries/PermissionsAndroid/PermissionsAndroid'; +import typeof PushNotificationIOS from './Libraries/PushNotificationIOS/PushNotificationIOS'; import typeof AppRegistry from './Libraries/ReactNative/AppRegistry'; -import typeof AppState from './Libraries/AppState/AppState'; +import typeof I18nManager from './Libraries/ReactNative/I18nManager'; +import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; +import typeof UIManager from './Libraries/ReactNative/UIManager'; +import typeof ReactNative from './Libraries/Renderer/shims/ReactNative'; +import type {HostComponent as _HostComponentInternal} from './Libraries/Renderer/shims/ReactNativeTypes'; +import typeof Settings from './Libraries/Settings/Settings'; +import typeof Share from './Libraries/Share/Share'; +import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes'; +// Plugins +import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS'; +import typeof processColor from './Libraries/StyleSheet/processColor'; +import typeof StyleSheet from './Libraries/StyleSheet/StyleSheet'; +import typeof Text from './Libraries/Text/Text'; +import typeof * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry'; +import typeof UTFSequence from './Libraries/UTFSequence'; +import typeof Appearance from './Libraries/Utilities/Appearance'; import typeof BackHandler from './Libraries/Utilities/BackHandler'; -import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard'; import typeof DeviceInfo from './Libraries/Utilities/DeviceInfo'; import typeof DevSettings from './Libraries/Utilities/DevSettings'; import typeof Dimensions from './Libraries/Utilities/Dimensions'; -import typeof Easing from './Libraries/Animated/Easing'; -import typeof ReactNative from './Libraries/Renderer/shims/ReactNative'; -import typeof I18nManager from './Libraries/ReactNative/I18nManager'; -import typeof InteractionManager from './Libraries/Interaction/InteractionManager'; -import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard'; -import typeof LayoutAnimation from './Libraries/LayoutAnimation/LayoutAnimation'; -import typeof Linking from './Libraries/Linking/Linking'; -import typeof LogBox from './Libraries/LogBox/LogBox'; -import typeof NativeDialogManagerAndroid from './Libraries/NativeModules/specs/NativeDialogManagerAndroid'; -import typeof NativeEventEmitter from './Libraries/EventEmitter/NativeEventEmitter'; -import typeof Networking from './Libraries/Network/RCTNetworking'; -import typeof PanResponder from './Libraries/Interaction/PanResponder'; -import typeof PermissionsAndroid from './Libraries/PermissionsAndroid/PermissionsAndroid'; import typeof PixelRatio from './Libraries/Utilities/PixelRatio'; -import typeof PushNotificationIOS from './Libraries/PushNotificationIOS/PushNotificationIOS'; -import typeof Settings from './Libraries/Settings/Settings'; -import typeof Share from './Libraries/Share/Share'; -import typeof StyleSheet from './Libraries/StyleSheet/StyleSheet'; -import typeof * as Systrace from './Libraries/Performance/Systrace'; -import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid'; -import typeof * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry'; -import typeof UIManager from './Libraries/ReactNative/UIManager'; -import typeof useAnimatedValue from './Libraries/Animated/useAnimatedValue'; +import typeof Platform from './Libraries/Utilities/Platform'; import typeof useColorScheme from './Libraries/Utilities/useColorScheme'; import typeof useWindowDimensions from './Libraries/Utilities/useWindowDimensions'; -import typeof UTFSequence from './Libraries/UTFSequence'; import typeof Vibration from './Libraries/Vibration/Vibration'; import typeof YellowBox from './Libraries/YellowBox/YellowBoxDeprecated'; -// Plugins -import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS'; -import typeof NativeModules from './Libraries/BatchedBridge/NativeModules'; -import typeof Platform from './Libraries/Utilities/Platform'; -import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes'; -import typeof processColor from './Libraries/StyleSheet/processColor'; -import typeof RCTDeviceEventEmitter from './Libraries/EventEmitter/RCTDeviceEventEmitter'; -import typeof RCTNativeAppEventEmitter from './Libraries/EventEmitter/RCTNativeAppEventEmitter'; -import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; - -import type {HostComponent as _HostComponentInternal} from './Libraries/Renderer/shims/ReactNativeTypes'; +const warnOnce = require('./Libraries/Utilities/warnOnce'); +const invariant = require('invariant'); export type HostComponent = _HostComponentInternal; -const invariant = require('invariant'); -const warnOnce = require('./Libraries/Utilities/warnOnce'); - module.exports = { // Components get AccessibilityInfo(): AccessibilityInfo { diff --git a/packages/react-native/jest/assetFileTransformer.js b/packages/react-native/jest/assetFileTransformer.js index 2e131c58923..c230a46e64c 100644 --- a/packages/react-native/jest/assetFileTransformer.js +++ b/packages/react-native/jest/assetFileTransformer.js @@ -11,9 +11,9 @@ /* eslint-env node */ -const path = require('path'); const createCacheKeyFunction = require('@jest/create-cache-key-function').default; +const path = require('path'); module.exports = { // Mocks asset requires to return the filename. Makes it possible to test that diff --git a/packages/react-native/jest/mockModal.js b/packages/react-native/jest/mockModal.js index 7618e922c58..d74eb040c86 100644 --- a/packages/react-native/jest/mockModal.js +++ b/packages/react-native/jest/mockModal.js @@ -12,9 +12,10 @@ 'use strict'; -const React = require('react'); import typeof Modal from '../Libraries/Modal/Modal'; +const React = require('react'); + function mockModal(BaseComponent: $FlowFixMe) { class ModalMock extends BaseComponent { render(): React.Element | null { diff --git a/packages/react-native/jest/mockScrollView.js b/packages/react-native/jest/mockScrollView.js index e8eb6937087..8a640276385 100644 --- a/packages/react-native/jest/mockScrollView.js +++ b/packages/react-native/jest/mockScrollView.js @@ -12,11 +12,10 @@ 'use strict'; -const React = require('react'); const View = require('../Libraries/Components/View/View'); - const requireNativeComponent = require('../Libraries/ReactNative/requireNativeComponent').default; +const React = require('react'); const RCTScrollView: $FlowFixMe = requireNativeComponent('RCTScrollView'); function mockScrollView(BaseComponent: $FlowFixMe) { diff --git a/packages/react-native/jest/renderer.js b/packages/react-native/jest/renderer.js index 18f551660f2..70bce6030f4 100644 --- a/packages/react-native/jest/renderer.js +++ b/packages/react-native/jest/renderer.js @@ -10,8 +10,8 @@ */ import * as React from 'react'; -import TestRenderer from 'react-test-renderer'; import ShallowRenderer from 'react-shallow-renderer'; +import TestRenderer from 'react-test-renderer'; const renderer = new ShallowRenderer(); diff --git a/packages/react-native/react-native.config.js b/packages/react-native/react-native.config.js index 73f60e93e2a..79a5f5249e2 100644 --- a/packages/react-native/react-native.config.js +++ b/packages/react-native/react-native.config.js @@ -9,8 +9,8 @@ 'use strict'; -const ios = require('@react-native-community/cli-platform-ios'); const android = require('@react-native-community/cli-platform-android'); +const ios = require('@react-native-community/cli-platform-ios'); const { bundleCommand, ramBundleCommand, diff --git a/packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js b/packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js index de2fd09e833..abcc3ed25f7 100644 --- a/packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js +++ b/packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js @@ -10,11 +10,11 @@ 'use strict'; -const underTest = require('../generate-artifacts-executor'); const fixtures = require('../__test_fixtures__/fixtures'); -const path = require('path'); -const fs = require('fs'); +const underTest = require('../generate-artifacts-executor'); const child_process = require('child_process'); +const fs = require('fs'); +const path = require('path'); const codegenConfigKey = 'codegenConfig'; const reactNativeDependencyName = 'react-native'; diff --git a/packages/react-native/scripts/codegen/__tests__/generate-specs-cli-executor-test.js b/packages/react-native/scripts/codegen/__tests__/generate-specs-cli-executor-test.js index 463ed28dbf6..3bad56cbae6 100644 --- a/packages/react-native/scripts/codegen/__tests__/generate-specs-cli-executor-test.js +++ b/packages/react-native/scripts/codegen/__tests__/generate-specs-cli-executor-test.js @@ -10,8 +10,8 @@ 'use strict'; -const sut = require('../generate-specs-cli-executor'); const fixtures = require('../__test_fixtures__/fixtures'); +const sut = require('../generate-specs-cli-executor'); const {normalize} = require('path'); describe('generateSpec', () => { diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor.js b/packages/react-native/scripts/codegen/generate-artifacts-executor.js index 025f80c7866..dc8a5bab381 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor.js @@ -16,7 +16,7 @@ * in a codegenConfigFilename file. */ -const {execSync, execFileSync} = require('child_process'); +const {execFileSync, execSync} = require('child_process'); const fs = require('fs'); const os = require('os'); const path = require('path'); diff --git a/packages/react-native/scripts/codegen/generate-legacy-interop-components.js b/packages/react-native/scripts/codegen/generate-legacy-interop-components.js index fa4641deee2..e1fba0dd8c6 100644 --- a/packages/react-native/scripts/codegen/generate-legacy-interop-components.js +++ b/packages/react-native/scripts/codegen/generate-legacy-interop-components.js @@ -9,9 +9,9 @@ 'use strict'; -const yargs = require('yargs'); const fs = require('fs'); const p = require('path'); +const yargs = require('yargs'); const CONFIG_FILE_NAME = 'react-native.config.js'; const PROJECT_FIELD = 'project'; diff --git a/packages/react-native/scripts/codegen/generate-specs-cli-executor.js b/packages/react-native/scripts/codegen/generate-specs-cli-executor.js index 8eda8012c8b..3f4f93cdc1c 100644 --- a/packages/react-native/scripts/codegen/generate-specs-cli-executor.js +++ b/packages/react-native/scripts/codegen/generate-specs-cli-executor.js @@ -9,10 +9,10 @@ 'use strict'; +const utils = require('./codegen-utils'); const fs = require('fs'); const mkdirp = require('mkdirp'); const path = require('path'); -const utils = require('./codegen-utils'); const RNCodegen = utils.getCodegen(); const GENERATORS = { diff --git a/packages/react-native/scripts/compose-source-maps.js b/packages/react-native/scripts/compose-source-maps.js index 02c405ecb2c..be908e97755 100755 --- a/packages/react-native/scripts/compose-source-maps.js +++ b/packages/react-native/scripts/compose-source-maps.js @@ -10,8 +10,8 @@ 'use strict'; -const {composeSourceMaps} = require('metro-source-map'); const fs = require('fs'); +const {composeSourceMaps} = require('metro-source-map'); const argv = process.argv.slice(2); let outputPath; diff --git a/packages/react-native/scripts/generate-specs-cli.js b/packages/react-native/scripts/generate-specs-cli.js index 19862d20131..2c3a0eb78b1 100644 --- a/packages/react-native/scripts/generate-specs-cli.js +++ b/packages/react-native/scripts/generate-specs-cli.js @@ -9,8 +9,8 @@ 'use strict'; -const yargs = require('yargs'); const executor = require('./codegen/generate-specs-cli-executor'); +const yargs = require('yargs'); const argv = yargs .option('p', { diff --git a/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js b/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js index dc81266293e..9df207d4479 100644 --- a/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js +++ b/packages/react-native/scripts/hermes/__tests__/hermes-utils-test.js @@ -9,8 +9,6 @@ import * as path from 'path'; -const os = require('os'); - const { configureMakeForPrebuiltHermesC, copyBuildScripts, @@ -19,25 +17,24 @@ const { createTarballFromDirectory, downloadHermesSourceTarball, expandHermesSourceTarball, - getHermesTarballDownloadPath, getHermesPrebuiltArtifactsTarballName, getHermesTagSHA, + getHermesTarballDownloadPath, readHermesTag, setHermesTag, shouldUsePrebuiltHermesC, } = require('../hermes-utils'); +const MemoryFs = require('metro-memory-fs'); +const os = require('os'); const hermesTag = 'hermes-2022-04-28-RNv0.69.0-15d07c2edd29a4ea0b8f15ab0588a0c1adb1200f'; const tarballContents = 'dummy string'; const hermescContents = 'dummy string'; const hermesTagSha = '5244f819b2f3949ca94a3a1bf75d54a8ed59d94a'; - const ROOT_DIR = path.normalize(path.join(__dirname, '../../..')); const SDKS_DIR = path.join(ROOT_DIR, 'sdks'); -const MemoryFs = require('metro-memory-fs'); - let execCalls, spawnCalls; let fs; diff --git a/packages/react-native/scripts/hermes/bump-hermes-version.js b/packages/react-native/scripts/hermes/bump-hermes-version.js index dc87fb8d5ba..09f2c135f36 100755 --- a/packages/react-native/scripts/hermes/bump-hermes-version.js +++ b/packages/react-native/scripts/hermes/bump-hermes-version.js @@ -10,14 +10,14 @@ 'use strict'; +const {setHermesTag} = require('./hermes-utils'); +const inquirer = require('inquirer'); /** * This script walks a releaser through bumping the Hermes version for a release. * It needs be executed on a release branch. */ const {exit} = require('shelljs'); const yargs = require('yargs'); -const inquirer = require('inquirer'); -const {setHermesTag} = require('./hermes-utils'); let argv = yargs.option('t', { alias: 'tag', diff --git a/packages/react-native/scripts/hermes/create-tarball.js b/packages/react-native/scripts/hermes/create-tarball.js index 29f6c1f416d..121d0a81397 100644 --- a/packages/react-native/scripts/hermes/create-tarball.js +++ b/packages/react-native/scripts/hermes/create-tarball.js @@ -9,16 +9,15 @@ 'use strict'; +const {createHermesPrebuiltArtifactsTarball} = require('./hermes-utils'); const fs = require('fs'); const os = require('os'); const path = require('path'); - /** * This script creates a Hermes prebuilt artifacts tarball. * Must be invoked after Hermes has been built. */ const yargs = require('yargs'); -const {createHermesPrebuiltArtifactsTarball} = require('./hermes-utils'); let argv = yargs .option('i', { diff --git a/packages/react-native/scripts/hermes/get-tarball-name.js b/packages/react-native/scripts/hermes/get-tarball-name.js index acb7817d0bf..6b9cafa789f 100644 --- a/packages/react-native/scripts/hermes/get-tarball-name.js +++ b/packages/react-native/scripts/hermes/get-tarball-name.js @@ -9,12 +9,12 @@ 'use strict'; +const {getHermesPrebuiltArtifactsTarballName} = require('./hermes-utils'); /** * This script returns the filename that would be used for a * Hermes tarball for the given build type and release version. */ const yargs = require('yargs'); -const {getHermesPrebuiltArtifactsTarballName} = require('./hermes-utils'); let argv = yargs.option('b', { alias: 'buildType', diff --git a/packages/react-native/scripts/hermes/hermes-utils.js b/packages/react-native/scripts/hermes/hermes-utils.js index c55969ef8da..5ee9f73e624 100644 --- a/packages/react-native/scripts/hermes/hermes-utils.js +++ b/packages/react-native/scripts/hermes/hermes-utils.js @@ -9,10 +9,10 @@ 'use strict'; +const {execSync, spawnSync} = require('child_process'); const fs = require('fs'); const os = require('os'); const path = require('path'); -const {execSync, spawnSync} = require('child_process'); const SDKS_DIR = path.normalize(path.join(__dirname, '..', '..', 'sdks')); const HERMES_DIR = path.join(SDKS_DIR, 'hermes'); diff --git a/packages/react-native/scripts/hermes/prepare-hermes-for-build.js b/packages/react-native/scripts/hermes/prepare-hermes-for-build.js index 87792738e7c..acb35fe0ec7 100644 --- a/packages/react-native/scripts/hermes/prepare-hermes-for-build.js +++ b/packages/react-native/scripts/hermes/prepare-hermes-for-build.js @@ -19,8 +19,8 @@ const { copyPodSpec, downloadHermesSourceTarball, expandHermesSourceTarball, - shouldUsePrebuiltHermesC, shouldBuildHermesFromSource, + shouldUsePrebuiltHermesC, } = require('./hermes-utils'); async function main(isInCI) { diff --git a/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js b/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js index 116ae680d99..b92a3b9596c 100644 --- a/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js +++ b/packages/react-native/sdks/hermes-engine/utils/replace_hermes_version.js @@ -9,9 +9,9 @@ 'use strict'; -const yargs = require('yargs'); -const fs = require('fs'); const {execSync} = require('child_process'); +const fs = require('fs'); +const yargs = require('yargs'); const LAST_BUILD_FILENAME = '.last_build_configuration'; diff --git a/packages/rn-tester-e2e/jest.setup.js b/packages/rn-tester-e2e/jest.setup.js index 40983cc22fe..8fe6ca69921 100644 --- a/packages/rn-tester-e2e/jest.setup.js +++ b/packages/rn-tester-e2e/jest.setup.js @@ -8,9 +8,10 @@ * @format */ -const wdio = require('webdriverio'); import capabilities from './e2e-config.js'; -import {beforeEach, afterEach, jest} from '@jest/globals'; +import {afterEach, beforeEach, jest} from '@jest/globals'; + +const wdio = require('webdriverio'); jest.retryTimes(3); let driver: any; diff --git a/packages/rn-tester-e2e/tests/screens/components/activityIndicatorComponent.screen.js b/packages/rn-tester-e2e/tests/screens/components/activityIndicatorComponent.screen.js index fb4ec28cbf9..b498546e340 100644 --- a/packages/rn-tester-e2e/tests/screens/components/activityIndicatorComponent.screen.js +++ b/packages/rn-tester-e2e/tests/screens/components/activityIndicatorComponent.screen.js @@ -10,8 +10,8 @@ import { UtilsSingleton as Utils, - iOSLabel, androidWidget, + iOSLabel, iOSName, } from '../../helpers/utils'; diff --git a/packages/rn-tester-e2e/tests/screens/components/buttonComponent.screen.js b/packages/rn-tester-e2e/tests/screens/components/buttonComponent.screen.js index af8a38ded55..5ac4975879c 100644 --- a/packages/rn-tester-e2e/tests/screens/components/buttonComponent.screen.js +++ b/packages/rn-tester-e2e/tests/screens/components/buttonComponent.screen.js @@ -10,8 +10,8 @@ import { UtilsSingleton as Utils, - iOSLabel, androidWidget, + iOSLabel, } from '../../helpers/utils'; type ButtonComponentScreenType = { diff --git a/packages/rn-tester-e2e/tests/screens/components/flatListComponent.screen.js b/packages/rn-tester-e2e/tests/screens/components/flatListComponent.screen.js index 6dd46e0da41..ee2f0090703 100644 --- a/packages/rn-tester-e2e/tests/screens/components/flatListComponent.screen.js +++ b/packages/rn-tester-e2e/tests/screens/components/flatListComponent.screen.js @@ -10,8 +10,8 @@ import { UtilsSingleton as Utils, - iOSLabel, androidWidget, + iOSLabel, iOSName, } from '../../helpers/utils'; diff --git a/packages/rn-tester/IntegrationTests/AccessibilityManagerTest.js b/packages/rn-tester/IntegrationTests/AccessibilityManagerTest.js index e68cd5bb682..45e1fab43cf 100644 --- a/packages/rn-tester/IntegrationTests/AccessibilityManagerTest.js +++ b/packages/rn-tester/IntegrationTests/AccessibilityManagerTest.js @@ -9,9 +9,9 @@ */ import invariant from 'invariant'; -import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager'; -import {DeviceEventEmitter, NativeModules, View} from 'react-native'; import * as React from 'react'; +import {DeviceEventEmitter, NativeModules, View} from 'react-native'; +import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager'; const {TestModule} = NativeModules; diff --git a/packages/rn-tester/IntegrationTests/AppEventsTest.js b/packages/rn-tester/IntegrationTests/AppEventsTest.js index e1736962006..0853b9edc99 100644 --- a/packages/rn-tester/IntegrationTests/AppEventsTest.js +++ b/packages/rn-tester/IntegrationTests/AppEventsTest.js @@ -12,11 +12,11 @@ const React = require('react'); const ReactNative = require('react-native'); +const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); + const {NativeAppEventEmitter, StyleSheet, Text, View} = ReactNative; const {TestModule} = ReactNative.NativeModules; -const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); - const TEST_PAYLOAD = {foo: 'bar'}; type AppEvent = { diff --git a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js index 46efb579d82..07294876363 100644 --- a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js +++ b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js @@ -10,24 +10,22 @@ 'use strict'; -const React = require('react'); -const ReactNative = require('react-native'); -const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; -const {TestModule} = ReactNative.NativeModules; - import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; - -const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); - -function debug(...args: Array) { - // console.log.apply(null, arguments); -} - import type { Layout, LayoutEvent, } from 'react-native/Libraries/Types/CoreEventTypes'; +const React = require('react'); +const ReactNative = require('react-native'); +const deepDiffer = require('react-native/Libraries/Utilities/differ/deepDiffer'); + +const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; +const {TestModule} = ReactNative.NativeModules; +function debug(...args: Array) { + // console.log.apply(null, arguments); +} + type Props = $ReadOnly<{||}>; type State = { diff --git a/packages/rn-tester/IntegrationTests/LoggingTestModule.js b/packages/rn-tester/IntegrationTests/LoggingTestModule.js index c18cd8b4254..5a04efad222 100644 --- a/packages/rn-tester/IntegrationTests/LoggingTestModule.js +++ b/packages/rn-tester/IntegrationTests/LoggingTestModule.js @@ -9,9 +9,8 @@ 'use strict'; -const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); - const invariant = require('invariant'); +const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); const LoggingTestModule = { logToConsole: function (str) { diff --git a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js index f1f48517e59..702ff568e6e 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js @@ -8,11 +8,12 @@ * @format */ -import * as React from 'react'; import type {HostComponent} from 'react-native'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import {requireNativeComponent, UIManager} from 'react-native'; + import ReactNative from '../../../react-native/Libraries/Renderer/shims/ReactNative'; +import * as React from 'react'; +import {UIManager, requireNativeComponent} from 'react-native'; type ColorChangedEvent = { nativeEvent: { diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeView.js b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js index 6dc2aa48f66..def1ba85eb3 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeView.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js @@ -8,16 +8,17 @@ * @format */ -import * as React from 'react'; -import {useRef, useState} from 'react'; -import {View, Button, Text, UIManager} from 'react-native'; +import type {MyLegacyViewType} from './MyLegacyViewNativeComponent'; +import type {MyNativeViewType} from './MyNativeViewNativeComponent'; + +import RNTMyLegacyNativeView from './MyLegacyViewNativeComponent'; +import {callNativeMethodToChangeBackgroundColor} from './MyLegacyViewNativeComponent'; import RNTMyNativeView, { Commands as RNTMyNativeViewCommands, } from './MyNativeViewNativeComponent'; -import RNTMyLegacyNativeView from './MyLegacyViewNativeComponent'; -import type {MyLegacyViewType} from './MyLegacyViewNativeComponent'; -import type {MyNativeViewType} from './MyNativeViewNativeComponent'; -import {callNativeMethodToChangeBackgroundColor} from './MyLegacyViewNativeComponent'; +import * as React from 'react'; +import {useRef, useState} from 'react'; +import {Button, Text, UIManager, View} from 'react-native'; const colors = [ '#0000FF', '#FF0000', diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js index e7b3ee28742..090c0e4c703 100644 --- a/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js @@ -8,17 +8,18 @@ * @format */ -import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; -import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; -import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type { - Float, - Double, - Int32, BubblingEventHandler, + Double, + Float, + Int32, } from 'react-native/Libraries/Types/CodegenTypes'; + import * as React from 'react'; +import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; +import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; type Event = $ReadOnly<{ values: $ReadOnlyArray, diff --git a/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js b/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js index 60aae1100ad..f0a039add0f 100644 --- a/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js +++ b/packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js @@ -9,9 +9,10 @@ */ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; -import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + export type ScreenshotManagerOptions = UnsafeObject; export interface Spec extends TurboModule { diff --git a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js index ede6b042700..a98f2ba87d9 100644 --- a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js +++ b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js @@ -10,11 +10,11 @@ 'use strict'; -const {requireNativeComponent} = require('react-native'); - +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; + +const {requireNativeComponent} = require('react-native'); type SnapshotReadyEvent = SyntheticEvent< $ReadOnly<{testIdentifier: string, ...}>, diff --git a/packages/rn-tester/js/RNTesterApp.android.js b/packages/rn-tester/js/RNTesterApp.android.js index eab01465ff9..5974d28a8a9 100644 --- a/packages/rn-tester/js/RNTesterApp.android.js +++ b/packages/rn-tester/js/RNTesterApp.android.js @@ -8,9 +8,8 @@ * @flow strict-local */ -import {AppRegistry} from 'react-native'; - import RNTesterApp from './RNTesterAppShared'; +import {AppRegistry} from 'react-native'; AppRegistry.registerComponent('RNTesterApp', () => RNTesterApp); diff --git a/packages/rn-tester/js/RNTesterApp.ios.js b/packages/rn-tester/js/RNTesterApp.ios.js index d997862b644..281ee25afd7 100644 --- a/packages/rn-tester/js/RNTesterApp.ios.js +++ b/packages/rn-tester/js/RNTesterApp.ios.js @@ -8,16 +8,15 @@ * @flow */ +import type {RNTesterModuleInfo} from './types/RNTesterTypes'; import type {Node} from 'react'; -import {AppRegistry} from 'react-native'; -import React from 'react'; - -import SnapshotViewIOS from './examples/Snapshot/SnapshotViewIOS.ios'; import RNTesterModuleContainer from './components/RNTesterModuleContainer'; -import RNTesterList from './utils/RNTesterList'; +import SnapshotViewIOS from './examples/Snapshot/SnapshotViewIOS.ios'; import RNTesterApp from './RNTesterAppShared'; -import type {RNTesterModuleInfo} from './types/RNTesterTypes'; +import RNTesterList from './utils/RNTesterList'; +import React from 'react'; +import {AppRegistry} from 'react-native'; AppRegistry.registerComponent('SetPropertiesExampleApp', () => require('./examples/SetPropertiesExample/SetPropertiesExampleApp'), diff --git a/packages/rn-tester/js/components/ListExampleShared.js b/packages/rn-tester/js/components/ListExampleShared.js index 32ddc5633f3..7260f2fbd07 100644 --- a/packages/rn-tester/js/components/ListExampleShared.js +++ b/packages/rn-tester/js/components/ListExampleShared.js @@ -11,17 +11,16 @@ 'use strict'; const React = require('react'); - const { ActivityIndicator, Animated, Image, Platform, - TouchableHighlight, StyleSheet, Switch, Text, TextInput, + TouchableHighlight, View, } = require('react-native'); diff --git a/packages/rn-tester/js/components/RNTConfigurationBlock.js b/packages/rn-tester/js/components/RNTConfigurationBlock.js index 25ebe6ce51f..38d94576754 100644 --- a/packages/rn-tester/js/components/RNTConfigurationBlock.js +++ b/packages/rn-tester/js/components/RNTConfigurationBlock.js @@ -10,9 +10,9 @@ 'use strict'; +import {RNTesterThemeContext} from './RNTesterTheme'; import * as React from 'react'; import {StyleSheet, View} from 'react-native'; -import {RNTesterThemeContext} from './RNTesterTheme'; type Props = $ReadOnly<{| children?: ?React.Node, diff --git a/packages/rn-tester/js/components/RNTOption.js b/packages/rn-tester/js/components/RNTOption.js index 0761424e17d..7d3d534277b 100644 --- a/packages/rn-tester/js/components/RNTOption.js +++ b/packages/rn-tester/js/components/RNTOption.js @@ -10,11 +10,12 @@ 'use strict'; -import * as React from 'react'; -import {Text, Pressable, StyleSheet, View} from 'react-native'; -import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; + import {RNTesterThemeContext} from './RNTesterTheme'; +import * as React from 'react'; +import {Pressable, StyleSheet, Text, View} from 'react-native'; type Props = $ReadOnly<{| testID?: ?string, diff --git a/packages/rn-tester/js/components/RNTPressableRow.js b/packages/rn-tester/js/components/RNTPressableRow.js index 3db9460e152..7cc02300615 100644 --- a/packages/rn-tester/js/components/RNTPressableRow.js +++ b/packages/rn-tester/js/components/RNTPressableRow.js @@ -8,11 +8,10 @@ * @flow strict-local */ -import * as React from 'react'; -import {RNTesterThemeContext} from './RNTesterTheme'; import RNTesterComponentTitle from './RNTesterComponentTitle'; - -import {Platform, StyleSheet, Pressable, Text, View} from 'react-native'; +import {RNTesterThemeContext} from './RNTesterTheme'; +import * as React from 'react'; +import {Platform, Pressable, StyleSheet, Text, View} from 'react-native'; type ViewStyleProp = $ElementType, 'style'>; type Props = { diff --git a/packages/rn-tester/js/components/RNTTestDetails.js b/packages/rn-tester/js/components/RNTTestDetails.js index 2bc82dedbb5..1b5d61e9bcb 100644 --- a/packages/rn-tester/js/components/RNTTestDetails.js +++ b/packages/rn-tester/js/components/RNTTestDetails.js @@ -8,9 +8,9 @@ * @flow strict-local */ -import * as React from 'react'; -import {View, Text, StyleSheet, Button, Platform} from 'react-native'; import {type RNTesterTheme} from './RNTesterTheme'; +import * as React from 'react'; +import {Button, Platform, StyleSheet, Text, View} from 'react-native'; function RNTTestDetails({ description, diff --git a/packages/rn-tester/js/components/RNTTitleBar.js b/packages/rn-tester/js/components/RNTTitleBar.js index d6094056e75..8c2ee0dc417 100644 --- a/packages/rn-tester/js/components/RNTTitleBar.js +++ b/packages/rn-tester/js/components/RNTTitleBar.js @@ -8,17 +8,17 @@ * @flow */ -import { - Text, - View, - SafeAreaView, - Button, - Platform, - StyleSheet, -} from 'react-native'; -import * as React from 'react'; import RNTesterDocumentationURL from './RNTesterDocumentationURL'; import {type RNTesterTheme} from './RNTesterTheme'; +import * as React from 'react'; +import { + Button, + Platform, + SafeAreaView, + StyleSheet, + Text, + View, +} from 'react-native'; const HeaderIOS = ({ onBack, diff --git a/packages/rn-tester/js/components/RNTesterBlock.js b/packages/rn-tester/js/components/RNTesterBlock.js index 58b41c5d6b8..8849ec4056b 100644 --- a/packages/rn-tester/js/components/RNTesterBlock.js +++ b/packages/rn-tester/js/components/RNTesterBlock.js @@ -8,8 +8,8 @@ * @flow */ -import * as React from 'react'; import {RNTesterThemeContext} from './RNTesterTheme'; +import * as React from 'react'; import {StyleSheet, Text, View} from 'react-native'; type Props = $ReadOnly<{| diff --git a/packages/rn-tester/js/components/RNTesterButton.js b/packages/rn-tester/js/components/RNTesterButton.js index 6f4ed2ad56e..d760b3a00ea 100644 --- a/packages/rn-tester/js/components/RNTesterButton.js +++ b/packages/rn-tester/js/components/RNTesterButton.js @@ -10,12 +10,11 @@ 'use strict'; -const React = require('react'); - -const {Pressable, StyleSheet, Text} = require('react-native'); - import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +const React = require('react'); +const {Pressable, StyleSheet, Text} = require('react-native'); + type Props = $ReadOnly<{| testID?: string, textTestID?: string, diff --git a/packages/rn-tester/js/components/RNTesterComponentTitle.js b/packages/rn-tester/js/components/RNTesterComponentTitle.js index 068fa15e744..633930682f9 100644 --- a/packages/rn-tester/js/components/RNTesterComponentTitle.js +++ b/packages/rn-tester/js/components/RNTesterComponentTitle.js @@ -8,8 +8,9 @@ * @flow strict-local */ -const React = require('react'); import {RNTesterThemeContext} from './RNTesterTheme'; + +const React = require('react'); const {StyleSheet, Text} = require('react-native'); type Props = $ReadOnly<{| diff --git a/packages/rn-tester/js/components/RNTesterExampleFilter.js b/packages/rn-tester/js/components/RNTesterExampleFilter.js index 530a42c2b87..dc37bd8b22e 100644 --- a/packages/rn-tester/js/components/RNTesterExampleFilter.js +++ b/packages/rn-tester/js/components/RNTesterExampleFilter.js @@ -8,19 +8,20 @@ * @flow */ -const React = require('react'); +import type {SectionData} from '../types/RNTesterTypes'; + +import {RNTesterThemeContext} from './RNTesterTheme'; + const RNTesterListFilters = require('./RNTesterListFilters'); +const React = require('react'); const { + Image, + Platform, + ScrollView, StyleSheet, TextInput, View, - ScrollView, - Image, - Platform, } = require('react-native'); -import {RNTesterThemeContext} from './RNTesterTheme'; - -import type {SectionData} from '../types/RNTesterTypes'; type Props = { filter: Function, diff --git a/packages/rn-tester/js/components/RNTesterListFilters.js b/packages/rn-tester/js/components/RNTesterListFilters.js index ddb14c3bd47..a7bde203551 100644 --- a/packages/rn-tester/js/components/RNTesterListFilters.js +++ b/packages/rn-tester/js/components/RNTesterListFilters.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {StyleSheet, Text, TouchableOpacity, View} = require('react-native'); const filters = ['Basic', 'UI', 'ListView', 'iOS', 'Android']; diff --git a/packages/rn-tester/js/components/RNTesterModuleContainer.js b/packages/rn-tester/js/components/RNTesterModuleContainer.js index bcf48da376d..94ff489bc9a 100644 --- a/packages/rn-tester/js/components/RNTesterModuleContainer.js +++ b/packages/rn-tester/js/components/RNTesterModuleContainer.js @@ -8,19 +8,20 @@ * @format */ -import * as React from 'react'; -const RNTesterBlock = require('./RNTesterBlock'); -const RNTesterExampleFilter = require('./RNTesterExampleFilter'); -import RNTPressableRow from './RNTPressableRow'; -import {RNTesterThemeContext, type RNTesterTheme} from './RNTesterTheme'; -import {View, Text, StyleSheet, Platform} from 'react-native'; -import RNTTestDetails from './RNTTestDetails'; - import type { RNTesterModule, RNTesterModuleExample, } from '../types/RNTesterTypes'; +import {type RNTesterTheme, RNTesterThemeContext} from './RNTesterTheme'; +import RNTPressableRow from './RNTPressableRow'; +import RNTTestDetails from './RNTTestDetails'; +import * as React from 'react'; +import {Platform, StyleSheet, Text, View} from 'react-native'; + +const RNTesterBlock = require('./RNTesterBlock'); +const RNTesterExampleFilter = require('./RNTesterExampleFilter'); + type Props = { module: RNTesterModule, example?: ?RNTesterModuleExample, diff --git a/packages/rn-tester/js/components/RNTesterModuleList.js b/packages/rn-tester/js/components/RNTesterModuleList.js index 6e601b2f1ae..cf484da75d6 100644 --- a/packages/rn-tester/js/components/RNTesterModuleList.js +++ b/packages/rn-tester/js/components/RNTesterModuleList.js @@ -8,13 +8,12 @@ * @flow */ -const RNTesterExampleFilter = require('./RNTesterExampleFilter'); -import RNTPressableRow from './RNTPressableRow'; -const React = require('react'); - -const {Platform, SectionList, StyleSheet, Text, View} = require('react-native'); - import {RNTesterThemeContext} from './RNTesterTheme'; +import RNTPressableRow from './RNTPressableRow'; + +const RNTesterExampleFilter = require('./RNTesterExampleFilter'); +const React = require('react'); +const {Platform, SectionList, StyleSheet, Text, View} = require('react-native'); /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ diff --git a/packages/rn-tester/js/components/RNTesterNavbar.js b/packages/rn-tester/js/components/RNTesterNavbar.js index 631cb09f1a8..8b49ab157c4 100644 --- a/packages/rn-tester/js/components/RNTesterNavbar.js +++ b/packages/rn-tester/js/components/RNTesterNavbar.js @@ -10,10 +10,9 @@ import type {RNTesterTheme} from './RNTesterTheme'; -import * as React from 'react'; -import {Text, View, StyleSheet, Image, Pressable} from 'react-native'; - import {RNTesterThemeContext} from './RNTesterTheme'; +import * as React from 'react'; +import {Image, Pressable, StyleSheet, Text, View} from 'react-native'; /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ diff --git a/packages/rn-tester/js/components/RNTesterPage.js b/packages/rn-tester/js/components/RNTesterPage.js index 8c1d615e5b8..c3bcd4ba633 100644 --- a/packages/rn-tester/js/components/RNTesterPage.js +++ b/packages/rn-tester/js/components/RNTesterPage.js @@ -8,11 +8,12 @@ * @flow */ +import {RNTesterThemeContext} from './RNTesterTheme'; +import {useContext} from 'react'; + const RNTesterTitle = require('./RNTesterTitle'); const React = require('react'); const {SafeAreaView, ScrollView, StyleSheet, View} = require('react-native'); -import {RNTesterThemeContext} from './RNTesterTheme'; -import {useContext} from 'react'; type Props = $ReadOnly<{| children?: React.Node, diff --git a/packages/rn-tester/js/components/RNTesterTheme.js b/packages/rn-tester/js/components/RNTesterTheme.js index b6eab148115..a94c7c54787 100644 --- a/packages/rn-tester/js/components/RNTesterTheme.js +++ b/packages/rn-tester/js/components/RNTesterTheme.js @@ -8,9 +8,10 @@ * @format */ +import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; + import * as React from 'react'; import {Appearance} from 'react-native'; -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet'; export type RNTesterTheme = { LabelColor: ColorValue, diff --git a/packages/rn-tester/js/components/RNTesterTitle.js b/packages/rn-tester/js/components/RNTesterTitle.js index b0f10116be7..948a0e89ca6 100644 --- a/packages/rn-tester/js/components/RNTesterTitle.js +++ b/packages/rn-tester/js/components/RNTesterTitle.js @@ -8,11 +8,11 @@ * @flow strict-local */ -const React = require('react'); - -const {StyleSheet, Text, View} = require('react-native'); import {RNTesterThemeContext} from './RNTesterTheme'; +const React = require('react'); +const {StyleSheet, Text, View} = require('react-native'); + class RNTesterTitle extends React.Component<$FlowFixMeProps> { render(): React.Node { return ( diff --git a/packages/rn-tester/js/components/TextInlineView.js b/packages/rn-tester/js/components/TextInlineView.js index d61a275d47c..94269d36018 100644 --- a/packages/rn-tester/js/components/TextInlineView.js +++ b/packages/rn-tester/js/components/TextInlineView.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {Image, Text, TouchableHighlight, View} = require('react-native'); function Basic(): React.Node { diff --git a/packages/rn-tester/js/components/TextLegend.js b/packages/rn-tester/js/components/TextLegend.js index 3cceccd484d..359dd67c2dc 100644 --- a/packages/rn-tester/js/components/TextLegend.js +++ b/packages/rn-tester/js/components/TextLegend.js @@ -8,9 +8,9 @@ * @flow strict-local */ -import * as React from 'react'; -import {Text, View, StyleSheet} from 'react-native'; import RNTOption from './RNTOption'; +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; const PANGRAMS = { arabic: diff --git a/packages/rn-tester/js/components/createExamplePage.js b/packages/rn-tester/js/components/createExamplePage.js index 62decfc0bbe..169f3835db8 100644 --- a/packages/rn-tester/js/components/createExamplePage.js +++ b/packages/rn-tester/js/components/createExamplePage.js @@ -10,10 +10,11 @@ 'use strict'; -const React = require('react'); +import type {RNTesterModule} from '../types/RNTesterTypes'; import RNTesterModuleContainer from './RNTesterModuleContainer'; -import type {RNTesterModule} from '../types/RNTesterTypes'; + +const React = require('react'); const createExamplePage = function ( title: ?string, diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.js index f5da9efc20e..6cce3364fcc 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.js @@ -10,17 +10,18 @@ 'use strict'; -const React = require('react'); import RNTesterBlock from '../../components/RNTesterBlock'; import RNTesterPage from '../../components/RNTesterPage'; import { Alert, StyleSheet, Text, - View, TouchableWithoutFeedback, + View, } from 'react-native'; +const React = require('react'); + const importantForAccessibilityValues = [ 'auto', 'yes', diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js index 2eaaee87219..f6d9126c67b 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js @@ -11,33 +11,31 @@ 'use strict'; import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; - -const React = require('react'); -const { - ImageBackground, - AccessibilityInfo, - TextInput, - Button, - Image, - Text, - View, - TouchableOpacity, - TouchableNativeFeedback, - TouchableWithoutFeedback, - Alert, - StyleSheet, - Platform, - Switch, - ScrollView, -} = require('react-native'); import type {EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter'; const RNTesterBlock = require('../../components/RNTesterBlock'); - const checkImageSource = require('./check.png'); -const uncheckImageSource = require('./uncheck.png'); const mixedCheckboxImageSource = require('./mixed.png'); +const uncheckImageSource = require('./uncheck.png'); +const React = require('react'); const {createRef} = require('react'); +const { + AccessibilityInfo, + Alert, + Button, + Image, + ImageBackground, + Platform, + ScrollView, + StyleSheet, + Switch, + Text, + TextInput, + TouchableNativeFeedback, + TouchableOpacity, + TouchableWithoutFeedback, + View, +} = require('react-native'); const styles = StyleSheet.create({ sectionContainer: { diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js index 92c2caac899..287c1bf63c7 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityIOSExample.js @@ -11,7 +11,7 @@ 'use strict'; const React = require('react'); -const {Text, View, Alert} = require('react-native'); +const {Alert, Text, View} = require('react-native'); type Props = $ReadOnly<{||}>; class AccessibilityIOSExample extends React.Component { diff --git a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js index 8f0ebaf041f..303d3186739 100644 --- a/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js +++ b/packages/rn-tester/js/examples/ActionSheetIOS/ActionSheetIOSExample.js @@ -12,16 +12,16 @@ import type {NativeMethods} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; +const ScreenshotManager = require('../../../NativeModuleExample/NativeScreenshotManager'); const React = require('react'); const { ActionSheetIOS, + Alert, StyleSheet, Text, View, - Alert, findNodeHandle, } = require('react-native'); -const ScreenshotManager = require('../../../NativeModuleExample/NativeScreenshotManager'); const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel']; const DESTRUCTIVE_INDEX = 3; diff --git a/packages/rn-tester/js/examples/Alert/AlertExample.js b/packages/rn-tester/js/examples/Alert/AlertExample.js index b822a9e6210..22d058e2c99 100644 --- a/packages/rn-tester/js/examples/Alert/AlertExample.js +++ b/packages/rn-tester/js/examples/Alert/AlertExample.js @@ -8,9 +8,10 @@ * @flow strict-local */ -import * as React from 'react'; import type {RNTesterModule} from '../../types/RNTesterTypes'; -import {Alert, StyleSheet, Text, Pressable, View} from 'react-native'; + +import * as React from 'react'; +import {Alert, Pressable, StyleSheet, Text, View} from 'react-native'; // Shows log on the screen const Log = ({message}: {message: string}) => diff --git a/packages/rn-tester/js/examples/Animated/AnimatedIndex.js b/packages/rn-tester/js/examples/Animated/AnimatedIndex.js index dbe87a82482..096470a8c7b 100644 --- a/packages/rn-tester/js/examples/Animated/AnimatedIndex.js +++ b/packages/rn-tester/js/examples/Animated/AnimatedIndex.js @@ -9,17 +9,18 @@ */ import type {RNTesterModule} from '../../types/RNTesterTypes'; -import RotatingImagesExample from './RotatingImagesExample'; + +import ColorStylesExample from './ColorStylesExample'; +import ComposeAnimationsWithEasingExample from './ComposeAnimationsWithEasingExample'; +import ComposingExample from './ComposingExample'; import ContinuousInteractionsExample from './ContinuousInteractionsExample'; -import LoopingExample from './LoopingExample'; -import MovingBoxExample from './MovingBoxExample'; import EasingExample from './EasingExample'; import FadeInViewExample from './FadeInViewExample'; -import ComposeAnimationsWithEasingExample from './ComposeAnimationsWithEasingExample'; +import LoopingExample from './LoopingExample'; +import MovingBoxExample from './MovingBoxExample'; +import RotatingImagesExample from './RotatingImagesExample'; import TransformBounceExample from './TransformBounceExample'; -import ComposingExample from './ComposingExample'; import TransformStylesExample from './TransformStylesExample'; -import ColorStylesExample from './ColorStylesExample'; export default ({ framework: 'React', diff --git a/packages/rn-tester/js/examples/Animated/ColorStylesExample.js b/packages/rn-tester/js/examples/Animated/ColorStylesExample.js index e13fcd24be6..548e0fd7dc2 100644 --- a/packages/rn-tester/js/examples/Animated/ColorStylesExample.js +++ b/packages/rn-tester/js/examples/Animated/ColorStylesExample.js @@ -9,11 +9,12 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import * as React from 'react'; -import {Animated, View, StyleSheet, Text} from 'react-native'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, Text, View} from 'react-native'; function AnimatedView({useNativeDriver}: {useNativeDriver: boolean}) { const animations = []; diff --git a/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js b/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js index d4630a90017..35e7ba7dd0a 100644 --- a/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposeAnimationsWithEasingExample.js @@ -9,10 +9,11 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import * as React from 'react'; -import RNTesterButton from '../../components/RNTesterButton'; -import {Text, Easing, StyleSheet, View, Animated} from 'react-native'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import RNTesterButton from '../../components/RNTesterButton'; +import * as React from 'react'; +import {Animated, Easing, StyleSheet, Text, View} from 'react-native'; const styles = StyleSheet.create({ content: { diff --git a/packages/rn-tester/js/examples/Animated/ComposingExample.js b/packages/rn-tester/js/examples/Animated/ComposingExample.js index e168a349f95..8e90e4a29ff 100644 --- a/packages/rn-tester/js/examples/Animated/ComposingExample.js +++ b/packages/rn-tester/js/examples/Animated/ComposingExample.js @@ -11,16 +11,17 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {CompositeAnimation} from 'react-native/Libraries/Animated/AnimatedMock'; import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue'; -import * as React from 'react'; + +import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; -import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import * as React from 'react'; import { - Text, - StyleSheet, - View, Animated, FlatList, + StyleSheet, + Text, + View, useWindowDimensions, } from 'react-native'; diff --git a/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js b/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js index cf37e3bcdfc..6514bf8af5f 100644 --- a/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js +++ b/packages/rn-tester/js/examples/Animated/ContinuousInteractionsExample.js @@ -9,6 +9,7 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import * as React from 'react'; import {Text} from 'react-native'; diff --git a/packages/rn-tester/js/examples/Animated/EasingExample.js b/packages/rn-tester/js/examples/Animated/EasingExample.js index a453d0d7f8e..d36e603d2ed 100644 --- a/packages/rn-tester/js/examples/Animated/EasingExample.js +++ b/packages/rn-tester/js/examples/Animated/EasingExample.js @@ -9,17 +9,18 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import * as React from 'react'; + +import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; -import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import * as React from 'react'; import { - Text, - StyleSheet, - View, Animated, - SectionList, Easing, + SectionList, + StyleSheet, + Text, + View, } from 'react-native'; type Props = $ReadOnly<{||}>; diff --git a/packages/rn-tester/js/examples/Animated/FadeInViewExample.js b/packages/rn-tester/js/examples/Animated/FadeInViewExample.js index 2d1b8a60f4e..3043a3f9b7d 100644 --- a/packages/rn-tester/js/examples/Animated/FadeInViewExample.js +++ b/packages/rn-tester/js/examples/Animated/FadeInViewExample.js @@ -9,11 +9,12 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import * as React from 'react'; + +import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; -import {Text, StyleSheet, View, Animated} from 'react-native'; -import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import * as React from 'react'; +import {Animated, StyleSheet, Text, View} from 'react-native'; const styles = StyleSheet.create({ content: { diff --git a/packages/rn-tester/js/examples/Animated/LoopingExample.js b/packages/rn-tester/js/examples/Animated/LoopingExample.js index 78dc345f2fe..ffa891294f9 100644 --- a/packages/rn-tester/js/examples/Animated/LoopingExample.js +++ b/packages/rn-tester/js/examples/Animated/LoopingExample.js @@ -8,13 +8,14 @@ * @format */ -import RNTesterButton from '../../components/RNTesterButton'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import {Animated, StyleSheet, Text, View} from 'react-native'; + +import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import RNTesterButton from '../../components/RNTesterButton'; +import ToggleNativeDriver from './utils/ToggleNativeDriver'; import * as React from 'react'; import {useEffect} from 'react'; -import ToggleNativeDriver from './utils/ToggleNativeDriver'; -import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import {Animated, StyleSheet, Text, View} from 'react-native'; export default ({ title: 'Looping Example', diff --git a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js index 180425758a5..efe0bae2f46 100644 --- a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js +++ b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js @@ -9,11 +9,12 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import * as React from 'react'; -import RNTesterButton from '../../components/RNTesterButton'; -import {Text, StyleSheet, View, Animated} from 'react-native'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, Text, View} from 'react-native'; const containerWidth = 200; const boxSize = 50; diff --git a/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js b/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js index 976c8edb986..7962dd758ef 100644 --- a/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js +++ b/packages/rn-tester/js/examples/Animated/RotatingImagesExample.js @@ -8,12 +8,13 @@ * @flow strict-local */ -import * as React from 'react'; -import RNTesterButton from '../../components/RNTesterButton'; -import {Animated, View, StyleSheet} from 'react-native'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ rotatingImage: { diff --git a/packages/rn-tester/js/examples/Animated/TransformBounceExample.js b/packages/rn-tester/js/examples/Animated/TransformBounceExample.js index 01cdc19e98d..55361d55e11 100644 --- a/packages/rn-tester/js/examples/Animated/TransformBounceExample.js +++ b/packages/rn-tester/js/examples/Animated/TransformBounceExample.js @@ -8,12 +8,13 @@ * @format */ -import * as React from 'react'; -import RNTesterButton from '../../components/RNTesterButton'; -import {Text, StyleSheet, View, Animated} from 'react-native'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; +import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, Text, View} from 'react-native'; const styles = StyleSheet.create({ content: { diff --git a/packages/rn-tester/js/examples/Animated/TransformStylesExample.js b/packages/rn-tester/js/examples/Animated/TransformStylesExample.js index d9467354097..f7db70b56d7 100644 --- a/packages/rn-tester/js/examples/Animated/TransformStylesExample.js +++ b/packages/rn-tester/js/examples/Animated/TransformStylesExample.js @@ -9,13 +9,14 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import {RNTesterThemeContext} from '../../components/RNTesterTheme'; -import RNTOption from '../../components/RNTOption'; -import * as React from 'react'; -import {Animated, Text, View, StyleSheet} from 'react-native'; + import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; +import {RNTesterThemeContext} from '../../components/RNTesterTheme'; +import RNTOption from '../../components/RNTOption'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, Text, View} from 'react-native'; const transformProperties = { rotate: {outputRange: ['0deg', '360deg'], selected: false}, diff --git a/packages/rn-tester/js/examples/Animated/utils/ToggleNativeDriver.js b/packages/rn-tester/js/examples/Animated/utils/ToggleNativeDriver.js index b58bd3a3889..2ec06cbf039 100644 --- a/packages/rn-tester/js/examples/Animated/utils/ToggleNativeDriver.js +++ b/packages/rn-tester/js/examples/Animated/utils/ToggleNativeDriver.js @@ -8,8 +8,8 @@ * @format */ -import {View, Text, StyleSheet, Switch} from 'react-native'; import * as React from 'react'; +import {StyleSheet, Switch, Text, View} from 'react-native'; type ViewStyleProp = $ElementType, 'style'>; diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExApp.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExApp.js index 52d081b7b9e..e6f7fe7a1c4 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExApp.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExApp.js @@ -10,6 +10,7 @@ 'use strict'; +const AnExSet = require('./AnExSet'); const React = require('react'); const { Animated, @@ -19,8 +20,6 @@ const { View, } = require('react-native'); -const AnExSet = require('./AnExSet'); - const CIRCLE_SIZE = 80; const CIRCLE_MARGIN = 18; const NUM_CIRCLES = 30; diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExChained.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExChained.js index 428b62d203b..b19508ec7b8 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExChained.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExChained.js @@ -10,11 +10,10 @@ 'use strict'; -import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import type {GestureState} from 'react-native/Libraries/Interaction/PanResponder'; +import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; const React = require('react'); - const {Animated, PanResponder, StyleSheet, View} = require('react-native'); class AnExChained extends React.Component { diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExScroll.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExScroll.js index 6b9c3bc8df2..8907b48e49b 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExScroll.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExScroll.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const { Animated, Image, diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js index 3a8ac0c3ee4..ea5b75df38b 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js @@ -10,6 +10,10 @@ 'use strict'; +const AnExBobble = require('./AnExBobble'); +const AnExChained = require('./AnExChained'); +const AnExScroll = require('./AnExScroll'); +const AnExTilt = require('./AnExTilt'); const React = require('react'); const { Animated, @@ -19,11 +23,6 @@ const { View, } = require('react-native'); -const AnExBobble = require('./AnExBobble'); -const AnExChained = require('./AnExChained'); -const AnExScroll = require('./AnExScroll'); -const AnExTilt = require('./AnExTilt'); - class AnExSet extends React.Component { constructor(props: Object) { super(props); diff --git a/packages/rn-tester/js/examples/AppState/AppStateExample.js b/packages/rn-tester/js/examples/AppState/AppStateExample.js index 5357f57c1c9..e41932a9c6b 100644 --- a/packages/rn-tester/js/examples/AppState/AppStateExample.js +++ b/packages/rn-tester/js/examples/AppState/AppStateExample.js @@ -12,10 +12,10 @@ import type {AppStateValues} from 'react-native/Libraries/AppState/AppState'; -const React = require('react'); - import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter'; -const {AppState, Text, View, Platform} = require('react-native'); + +const React = require('react'); +const {AppState, Platform, Text, View} = require('react-native'); class AppStateSubscription extends React.Component< $FlowFixMeProps, diff --git a/packages/rn-tester/js/examples/Appearance/AppearanceExample.js b/packages/rn-tester/js/examples/Appearance/AppearanceExample.js index f9ff4e6df0a..8d7c3472465 100644 --- a/packages/rn-tester/js/examples/Appearance/AppearanceExample.js +++ b/packages/rn-tester/js/examples/Appearance/AppearanceExample.js @@ -8,14 +8,15 @@ * @flow */ -import * as React from 'react'; -import {useState, useEffect} from 'react'; -import {Appearance, Text, useColorScheme, View, Button} from 'react-native'; import type { AppearancePreferences, ColorSchemeName, } from 'react-native/Libraries/Utilities/NativeAppearance'; + import {RNTesterThemeContext, themes} from '../../components/RNTesterTheme'; +import * as React from 'react'; +import {useEffect, useState} from 'react'; +import {Appearance, Button, Text, View, useColorScheme} from 'react-native'; function ColorSchemeSubscription() { const [colorScheme, setScheme] = useState( diff --git a/packages/rn-tester/js/examples/Border/BorderExample.js b/packages/rn-tester/js/examples/Border/BorderExample.js index 279c439cea7..c2ad231bd32 100644 --- a/packages/rn-tester/js/examples/Border/BorderExample.js +++ b/packages/rn-tester/js/examples/Border/BorderExample.js @@ -11,14 +11,14 @@ 'use strict'; import type {RNTesterModule} from '../../types/RNTesterTypes'; -import * as React from 'react'; +import * as React from 'react'; import { + DynamicColorIOS, + Platform, + PlatformColor, StyleSheet, View, - PlatformColor, - Platform, - DynamicColorIOS, } from 'react-native'; const styles = StyleSheet.create({ diff --git a/packages/rn-tester/js/examples/Button/ButtonExample.js b/packages/rn-tester/js/examples/Button/ButtonExample.js index 3f49b611966..332f9cd6669 100644 --- a/packages/rn-tester/js/examples/Button/ButtonExample.js +++ b/packages/rn-tester/js/examples/Button/ButtonExample.js @@ -10,10 +10,9 @@ 'use strict'; -const React = require('react'); - -const {Alert, Button, View, StyleSheet} = require('react-native'); const {RNTesterThemeContext} = require('../../components/RNTesterTheme'); +const React = require('react'); +const {Alert, Button, StyleSheet, View} = require('react-native'); function onButtonPress(buttonName: string) { Alert.alert(`Your application has been ${buttonName}!`); diff --git a/packages/rn-tester/js/examples/Crash/CrashExample.js b/packages/rn-tester/js/examples/Crash/CrashExample.js index a1fe3a2cfe0..75376815cae 100644 --- a/packages/rn-tester/js/examples/Crash/CrashExample.js +++ b/packages/rn-tester/js/examples/Crash/CrashExample.js @@ -9,8 +9,9 @@ */ import type {Node} from 'react'; -import {Button} from 'react-native'; + import React from 'react'; +import {Button} from 'react-native'; exports.displayName = (undefined: ?string); exports.framework = 'React'; diff --git a/packages/rn-tester/js/examples/Dimensions/DimensionsExample.js b/packages/rn-tester/js/examples/Dimensions/DimensionsExample.js index 8e8d1a28da4..b37d4476dc6 100644 --- a/packages/rn-tester/js/examples/Dimensions/DimensionsExample.js +++ b/packages/rn-tester/js/examples/Dimensions/DimensionsExample.js @@ -8,9 +8,9 @@ * @flow */ -import {Dimensions, Text, useWindowDimensions} from 'react-native'; import * as React from 'react'; -import {useState, useEffect} from 'react'; +import {useEffect, useState} from 'react'; +import {Dimensions, Text, useWindowDimensions} from 'react-native'; type Props = {dim: string}; diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js index fb61fceaf58..c56357bbdb2 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js @@ -8,10 +8,11 @@ * @flow strict-local */ -import * as React from 'react'; -import {Text, Animated, StyleSheet} from 'react-native'; import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; + import ToggleNativeDriver from '../../Animated/utils/ToggleNativeDriver'; +import * as React from 'react'; +import {Animated, StyleSheet, Text} from 'react-native'; const WIDTH = 200; const HEIGHT = 250; diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js index d007348733e..6c528c3d57b 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityNativeGestureHandling.js @@ -8,11 +8,12 @@ * @flow strict-local */ -import * as React from 'react'; -import {ScrollView, View, StyleSheet} from 'react-native'; -import EventfulView from '../W3CPointerEventsEventfulView'; import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; +import EventfulView from '../W3CPointerEventsEventfulView'; +import * as React from 'react'; +import {ScrollView, StyleSheet, View} from 'react-native'; + const styles = StyleSheet.create({ container: { borderWidth: 1, diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js b/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js index 8d779de97fb..c0a57596a9b 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js @@ -8,11 +8,12 @@ * @flow strict-local */ -import * as React from 'react'; -import {View, Text, StyleSheet} from 'react-native'; import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; + const styles = StyleSheet.create({ container: {height: '30%', width: '100%', backgroundColor: 'black'}, properties: {}, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js index ddb4d6e06fa..94aa4145b75 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js @@ -10,12 +10,11 @@ import type {PlatformTestComponentBaseProps} from './RNTesterPlatformTestTypes'; -import * as React from 'react'; -import {StyleSheet, View, Text} from 'react-native'; - import RNTesterPlatformTestInstructions from './RNTesterPlatformTestInstructions'; -import usePlatformTestHarness from './usePlatformTestHarness'; import RNTesterPlatformTestResultView from './RNTesterPlatformTestResultView'; +import usePlatformTestHarness from './usePlatformTestHarness'; +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; type Props = $ReadOnly<{| title: string, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js index a9d7b4de94a..4968f45339e 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestInstructions.js @@ -8,11 +8,11 @@ * @flow strict-local */ -import * as React from 'react'; -import {View, Text, StyleSheet} from 'react-native'; - import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; + type Props = $ReadOnly<{| instructions?: $ReadOnlyArray, style?: ?ViewStyleProp, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js index b12566b4031..4f904d0a51c 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js @@ -11,9 +11,8 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import RNTesterPlatformTestResultsText from './RNTesterPlatformTestResultsText'; - import * as React from 'react'; -import {View, Text, StyleSheet, TouchableHighlight} from 'react-native'; +import {StyleSheet, Text, TouchableHighlight, View} from 'react-native'; type Props = $ReadOnly<{| numFail: number, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js index 255cac6a79e..099858d92a6 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js @@ -8,34 +8,33 @@ * @flow strict-local */ -import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; -import type { - ViewStyleProp, - TextStyle, -} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { PlatformTestResult, PlatformTestResultStatus, } from './RNTesterPlatformTestTypes'; +import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; +import type { + TextStyle, + ViewStyleProp, +} from 'react-native/Libraries/StyleSheet/StyleSheet'; import RNTesterPlatformTestMinimizedResultView from './RNTesterPlatformTestMinimizedResultView'; import RNTesterPlatformTestResultsText from './RNTesterPlatformTestResultsText'; - import * as React from 'react'; -import {useMemo, useState, useCallback} from 'react'; +import {useCallback, useMemo, useState} from 'react'; import { Button, - Switch, - View, - Text, - StyleSheet, FlatList, - Modal, - SafeAreaView, - TextInput, KeyboardAvoidingView, + Modal, Platform, + SafeAreaView, + StyleSheet, + Switch, + Text, + TextInput, TouchableOpacity, + View, } from 'react-native'; const DISPLAY_STATUS_MAPPING: {[PlatformTestResultStatus]: string} = { diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js index 92f5fad3360..b111803168f 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultsText.js @@ -8,8 +8,8 @@ * @flow strict-local */ -import {Text, StyleSheet} from 'react-native'; import * as React from 'react'; +import {StyleSheet, Text} from 'react-native'; type Props = $ReadOnly<{ numPass: number, diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js index b0cd68e06f1..f6a1bb5023e 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/usePlatformTestHarness.js @@ -8,17 +8,17 @@ * @flow */ -import {useState, useCallback, useMemo, useRef, useEffect} from 'react'; - import type { - PlatformTestResult, - PlatformTestHarness, - PlatformTestCase, PlatformTestAssertionResult, + PlatformTestCase, PlatformTestContext, + PlatformTestHarness, + PlatformTestResult, SyncTestOptions, } from './RNTesterPlatformTestTypes'; +import {useCallback, useEffect, useMemo, useRef, useState} from 'react'; + type AsyncTestStatus = 'NOT_RAN' | 'COMPLETED' | 'TIMED_OUT'; function didAllAssertionsPass( diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAccessibility.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAccessibility.js index ed00ed33223..9335ce8cfe0 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAccessibility.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventAccessibility.js @@ -8,13 +8,14 @@ * @flow strict-local */ -import * as React from 'react'; -import {useState} from 'react'; -import {StyleSheet, View, Pressable, ScrollView, Text} from 'react-native'; -import {EventTracker} from './PointerEventSupport'; import type {EventOccurrence} from './PointerEventSupport'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +import {EventTracker} from './PointerEventSupport'; +import * as React from 'react'; +import {useState} from 'react'; +import {Pressable, ScrollView, StyleSheet, Text, View} from 'react-native'; + const eventsToTrack = ['onClick']; export default function PointerEventAccessibility(props: {}): React.MixedElement { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js index 20ead454265..d5db79dc457 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js @@ -9,13 +9,13 @@ */ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; +import type {ElementRef} from 'react'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import * as React from 'react'; import {useCallback, useRef} from 'react'; -import {StyleSheet, View, Text} from 'react-native'; -import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; -import type {ElementRef} from 'react'; +import {StyleSheet, Text, View} from 'react-native'; // adapted from https://github.com/web-platform-tests/wpt/blob/master/pointerevents/pointerevent_capture_mouse.html function PointerEventCaptureMouseTestCase( diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js index 39a8c449ecd..69d448082c8 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js @@ -9,14 +9,14 @@ */ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; +import type {PlatformTestContext} from '../PlatformTest/RNTesterPlatformTestTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import {check_PointerEvent} from './PointerEventSupport'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import {check_PointerEvent} from './PointerEventSupport'; import * as React from 'react'; -import {useRef, useCallback} from 'react'; +import {useCallback, useRef} from 'react'; import {StyleSheet, View} from 'react-native'; -import type {PlatformTestContext} from '../PlatformTest/RNTesterPlatformTestTypes'; function checkClickEventProperties( assert_equals: PlatformTestContext['assert_equals'], diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js index 3b7380fa7e8..031d76f4c0e 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy.js @@ -9,14 +9,14 @@ */ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; +import type {EventOccurrence} from './PointerEventSupport'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import {EventTracker} from './PointerEventSupport'; +import {mkEvent} from './PointerEventSupport'; import * as React from 'react'; import {useRef} from 'react'; import {StyleSheet, View} from 'react-native'; -import {EventTracker} from './PointerEventSupport'; -import type {EventOccurrence} from './PointerEventSupport'; -import {mkEvent} from './PointerEventSupport'; const eventsToTrack = ['onClick', 'onPointerDown', 'onPointerUp']; diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js index 157ebd2ed6f..7db11831df7 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents.js @@ -12,8 +12,8 @@ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatf import type {EventOccurrence, EventTrackerProps} from './PointerEventSupport'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; -import {EventTracker, mkEvent} from './PointerEventSupport'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import {EventTracker, mkEvent} from './PointerEventSupport'; import * as React from 'react'; import {useRef} from 'react'; import {StyleSheet, View} from 'react-native'; diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js index 0cf25831c33..27c9567e93e 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver.js @@ -13,7 +13,7 @@ import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import * as React from 'react'; -import {useRef, useCallback, useState, useMemo} from 'react'; +import {useCallback, useMemo, useRef, useState} from 'react'; import {StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js index 2a58e995932..36cca7e7ce6 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js @@ -15,7 +15,7 @@ import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import {check_PointerEvent} from './PointerEventSupport'; import * as React from 'react'; import {useCallback, useRef} from 'react'; -import {StyleSheet, View, ScrollView} from 'react-native'; +import {ScrollView, StyleSheet, View} from 'react-native'; // adapted from https://github.com/web-platform-tests/wpt/blob/master/pointerevents/pointerevent_pointercancel_touch.html function PointerEventPointerCancelTouchTestCase( diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js index 50a24736195..49fbc258439 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMove.js @@ -13,8 +13,8 @@ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import {useTestEventHandler} from './PointerEventSupport'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import {useTestEventHandler} from './PointerEventSupport'; import * as React from 'react'; import {useRef} from 'react'; import {StyleSheet, View} from 'react-native'; diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js index c45862e5f66..26574a1076d 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveAcross.js @@ -14,7 +14,7 @@ import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import RNTesterPlatformTestEventRecorder from '../PlatformTest/RNTesterPlatformTestEventRecorder'; import * as React from 'react'; import {useCallback, useState} from 'react'; -import {View, StyleSheet} from 'react-native'; +import {StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ a: { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js index b527aefb3f3..f72b5761de7 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveBetween.js @@ -14,7 +14,7 @@ import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import RNTesterPlatformTestEventRecorder from '../PlatformTest/RNTesterPlatformTestEventRecorder'; import * as React from 'react'; import {useCallback, useState} from 'react'; -import {View, StyleSheet} from 'react-native'; +import {StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ a: { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js index c1f0239dd93..d5267dfea7b 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder.js @@ -11,11 +11,11 @@ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import RNTesterPlatformTestEventRecorder from '../PlatformTest/RNTesterPlatformTestEventRecorder'; import * as React from 'react'; import {useCallback, useState} from 'react'; -import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import {StyleSheet, View} from 'react-native'; -import RNTesterPlatformTestEventRecorder from '../PlatformTest/RNTesterPlatformTestEventRecorder'; const styles = StyleSheet.create({ end: { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js index 422e406e7c6..7956a7d16fb 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton.js @@ -14,7 +14,7 @@ import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; import * as React from 'react'; import {useCallback, useRef} from 'react'; -import {View, StyleSheet} from 'react-native'; +import {StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ target: { diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js index 7f5a14fe0c0..24dff3c6baa 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer.js @@ -11,10 +11,10 @@ import type {PlatformTestComponentBaseProps} from '../PlatformTest/RNTesterPlatformTestTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import {useTestEventHandler} from './PointerEventSupport'; import RNTesterPlatformTest from '../PlatformTest/RNTesterPlatformTest'; +import {useTestEventHandler} from './PointerEventSupport'; import * as React from 'react'; -import {useRef, useCallback, useMemo} from 'react'; +import {useCallback, useMemo, useRef} from 'react'; import {StyleSheet, View} from 'react-native'; const styles = StyleSheet.create({ diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js index defcc596d17..d65b88ba21c 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js @@ -12,10 +12,9 @@ import type {PlatformTestHarness} from '../PlatformTest/RNTesterPlatformTestType import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import {View} from 'react-native'; import * as React from 'react'; - import {useMemo} from 'react'; +import {View} from 'react-native'; // These props are not in the specification but are present in the WPT so we keep them // but marked as skipped so we don't prioritize them diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js index 25383fcc6e9..94dd82caae6 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsEventfulView.js @@ -8,10 +8,11 @@ * @flow */ -import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import {StyleSheet, View, Text} from 'react-native'; -import * as React from 'react'; import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; + +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; export default function EventfulView(props: {| name: string, diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js index 944d31bcfad..8d6a51d6358 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js @@ -8,29 +8,28 @@ * @flow strict-local */ -import {Button, StyleSheet, ScrollView, View, Text} from 'react-native'; -import * as React from 'react'; - -import PointerEventAttributesHoverablePointers from './W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers'; -import PointerEventPointerMove from './W3CPointerEventPlatformTests/PointerEventPointerMove'; import CompatibilityAnimatedPointerMove from './Compatibility/CompatibilityAnimatedPointerMove'; import CompatibilityNativeGestureHandling from './Compatibility/CompatibilityNativeGestureHandling'; -import PointerEventPrimaryTouchPointer from './W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer'; +import ManyPointersPropertiesExample from './Compatibility/ManyPointersPropertiesExample'; +import PointerEventAccessibility from './W3CPointerEventPlatformTests/PointerEventAccessibility'; +import PointerEventAttributesHoverablePointers from './W3CPointerEventPlatformTests/PointerEventAttributesHoverablePointers'; import PointerEventAttributesNoHoverPointers from './W3CPointerEventPlatformTests/PointerEventAttributesNoHoverPointers'; -import PointerEventPointerMoveOnChordedMouseButton from './W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton'; -import PointerEventPointerMoveAcross from './W3CPointerEventPlatformTests/PointerEventPointerMoveAcross'; -import PointerEventPointerMoveEventOrder from './W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder'; -import PointerEventPointerMoveBetween from './W3CPointerEventPlatformTests/PointerEventPointerMoveBetween'; -import PointerEventPointerOverOut from './W3CPointerEventPlatformTests/PointerEventPointerOverOut'; -import PointerEventLayoutChangeShouldFirePointerOver from './W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver'; -import PointerEventPointerCancelTouch from './W3CPointerEventPlatformTests/PointerEventPointerCancelTouch'; +import PointerEventCaptureMouse from './W3CPointerEventPlatformTests/PointerEventCaptureMouse'; import PointerEventClickTouch from './W3CPointerEventPlatformTests/PointerEventClickTouch'; import PointerEventClickTouchHierarchy from './W3CPointerEventPlatformTests/PointerEventClickTouchHierarchy'; -import PointerEventCaptureMouse from './W3CPointerEventPlatformTests/PointerEventCaptureMouse'; -import EventfulView from './W3CPointerEventsEventfulView'; -import ManyPointersPropertiesExample from './Compatibility/ManyPointersPropertiesExample'; import PointerEventClickTouchHierarchyPointerEvents from './W3CPointerEventPlatformTests/PointerEventClickTouchHierarchyPointerEvents'; -import PointerEventAccessibility from './W3CPointerEventPlatformTests/PointerEventAccessibility'; +import PointerEventLayoutChangeShouldFirePointerOver from './W3CPointerEventPlatformTests/PointerEventLayoutChangeShouldFirePointerOver'; +import PointerEventPointerCancelTouch from './W3CPointerEventPlatformTests/PointerEventPointerCancelTouch'; +import PointerEventPointerMove from './W3CPointerEventPlatformTests/PointerEventPointerMove'; +import PointerEventPointerMoveAcross from './W3CPointerEventPlatformTests/PointerEventPointerMoveAcross'; +import PointerEventPointerMoveBetween from './W3CPointerEventPlatformTests/PointerEventPointerMoveBetween'; +import PointerEventPointerMoveEventOrder from './W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder'; +import PointerEventPointerMoveOnChordedMouseButton from './W3CPointerEventPlatformTests/PointerEventPointerMoveOnChordedMouseButton'; +import PointerEventPointerOverOut from './W3CPointerEventPlatformTests/PointerEventPointerOverOut'; +import PointerEventPrimaryTouchPointer from './W3CPointerEventPlatformTests/PointerEventPrimaryTouchPointer'; +import EventfulView from './W3CPointerEventsEventfulView'; +import * as React from 'react'; +import {Button, ScrollView, StyleSheet, Text, View} from 'react-native'; function AbsoluteChildExample({log}: {log: string => void}) { return ( diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index b53b37e7f6d..56b737acf41 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -10,11 +10,29 @@ 'use strict'; +import type {Item} from '../../components/ListExampleShared'; +import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {AnimatedComponentType} from 'react-native/Libraries/Animated/createAnimatedComponent'; import typeof FlatListType from 'react-native/Libraries/Lists/FlatList'; import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; -import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import { + FooterComponent, + HeaderComponent, + ItemComponent, + ItemSeparatorComponent, + ListEmptyComponent, + LoadingComponent, + PlainInput, + SeparatorComponent, + Spindicator, + genNewerItems, + genOlderItems, + getItemLayout, + pressItem, + renderSmallSwitchOption, +} from '../../components/ListExampleShared'; +import RNTesterPage from '../../components/RNTesterPage'; import * as React from 'react'; import { Alert, @@ -25,26 +43,7 @@ import { TextInput, View, } from 'react-native'; -import RNTesterPage from '../../components/RNTesterPage'; import infoLog from 'react-native/Libraries/Utilities/infoLog'; -import { - FooterComponent, - HeaderComponent, - ItemComponent, - ListEmptyComponent, - ItemSeparatorComponent, - PlainInput, - SeparatorComponent, - LoadingComponent, - Spindicator, - genNewerItems, - genOlderItems, - getItemLayout, - pressItem, - renderSmallSwitchOption, -} from '../../components/ListExampleShared'; - -import type {Item} from '../../components/ListExampleShared'; const PAGE_SIZE = 100; const NUM_PAGES = 10; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js b/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js index eaec73c6225..8717e8e19b5 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-contentInset.js @@ -9,10 +9,10 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -import {StyleSheet, Text, View} from 'react-native'; -import BaseFlatListExample from './BaseFlatListExample'; +import BaseFlatListExample from './BaseFlatListExample'; import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; export function FlatList_contentInset(): React.Node { const [initialContentInset, toggledContentInset] = [44, 88]; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js b/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js index 033893d4ce3..e90e55f1325 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-inverted.js @@ -9,6 +9,7 @@ */ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import BaseFlatListExample from './BaseFlatListExample'; import * as React from 'react'; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js index fd8d10a4347..89e124c6dc3 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-multiColumn.js @@ -10,12 +10,9 @@ 'use strict'; -import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; +import type {Item} from '../../components/ListExampleShared'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; -const RNTesterPage = require('../../components/RNTesterPage'); -const React = require('react'); - -const infoLog = require('react-native/Libraries/Utilities/infoLog'); +import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; const { FooterComponent, @@ -28,9 +25,10 @@ const { pressItem, renderSmallSwitchOption, } = require('../../components/ListExampleShared'); -const {FlatList, StyleSheet, Text, View, Alert} = require('react-native'); - -import type {Item} from '../../components/ListExampleShared'; +const RNTesterPage = require('../../components/RNTesterPage'); +const React = require('react'); +const {Alert, FlatList, StyleSheet, Text, View} = require('react-native'); +const infoLog = require('react-native/Libraries/Utilities/infoLog'); class MultiColumnExample extends React.PureComponent< $FlowFixMeProps, diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-nested.js b/packages/rn-tester/js/examples/FlatList/FlatList-nested.js index 0871afa15cd..6a3f27905a3 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-nested.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-nested.js @@ -9,9 +9,9 @@ */ 'use strict'; +import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {ViewToken} from 'react-native/Libraries/Lists/ViewabilityHelper'; import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; -import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import RNTesterPage from '../../components/RNTesterPage'; import * as React from 'react'; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js b/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js index 84f1fcaf422..de1d2f4c9ba 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onStartReached.js @@ -10,6 +10,7 @@ 'use strict'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import BaseFlatListExample, {ITEM_HEIGHT} from './BaseFlatListExample'; import * as React from 'react'; import {FlatList} from 'react-native'; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js index f65111e1659..72764795749 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-onViewableItemsChanged.js @@ -10,8 +10,8 @@ 'use strict'; -import type {ViewToken} from 'react-native/Libraries/Lists/ViewabilityHelper'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import type {ViewToken} from 'react-native/Libraries/Lists/ViewabilityHelper'; import BaseFlatListExample from './BaseFlatListExample'; import * as React from 'react'; diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js b/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js index 8660e5c48cb..d4a50689d3f 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js @@ -8,8 +8,8 @@ * @format */ -import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList'; import * as React from 'react'; import {FlatList, StyleSheet, Text, View} from 'react-native'; diff --git a/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js b/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js index bdfbb8a237f..2a64d772cde 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js +++ b/packages/rn-tester/js/examples/FlatList/FlatListExampleIndex.js @@ -9,16 +9,17 @@ */ import type {RNTesterModule} from '../../types/RNTesterTypes'; + import BasicExample from './FlatList-basic'; -import OnStartReachedExample from './FlatList-onStartReached'; -import OnEndReachedExample from './FlatList-onEndReached'; import ContentInsetExample from './FlatList-contentInset'; import InvertedExample from './FlatList-inverted'; -import onViewableItemsChangedExample from './FlatList-onViewableItemsChanged'; -import WithSeparatorsExample from './FlatList-withSeparators'; import MultiColumnExample from './FlatList-multiColumn'; -import StickyHeadersExample from './FlatList-stickyHeaders'; import NestedExample from './FlatList-nested'; +import OnEndReachedExample from './FlatList-onEndReached'; +import OnStartReachedExample from './FlatList-onStartReached'; +import onViewableItemsChangedExample from './FlatList-onViewableItemsChanged'; +import StickyHeadersExample from './FlatList-stickyHeaders'; +import WithSeparatorsExample from './FlatList-withSeparators'; export default ({ framework: 'React', diff --git a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js index 02bb0e21184..30afdb8b3f4 100644 --- a/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js +++ b/packages/rn-tester/js/examples/Image/ImageCapInsetsExample.js @@ -12,7 +12,6 @@ const React = require('react'); const ReactNative = require('react-native'); - const nativeImageSource = require('react-native/Libraries/Image/nativeImageSource'); const {Image, StyleSheet, Text, View} = ReactNative; diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index 56125187231..4f18636bdba 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -12,20 +12,18 @@ import type {LayoutEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +const ImageCapInsetsExample = require('./ImageCapInsetsExample'); const React = require('react'); - const { Image, + ImageBackground, StyleSheet, Text, View, - ImageBackground, } = require('react-native'); const base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg=='; - -const ImageCapInsetsExample = require('./ImageCapInsetsExample'); const IMAGE_PREFETCH_URL = 'https://www.facebook.com/favicon.ico?r=1&t=' + Date.now(); const prefetchTask = Image.prefetch(IMAGE_PREFETCH_URL); diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverBenchmark.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverBenchmark.js index 7932f6dc2ff..d7784475a50 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverBenchmark.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverBenchmark.js @@ -9,14 +9,13 @@ */ import {RNTesterThemeContext} from '../../components/RNTesterTheme'; - import * as React from 'react'; import { - useLayoutEffect, - useState, - useRef, type ElementRef, useContext, + useLayoutEffect, + useRef, + useState, } from 'react'; import {Button, ScrollView, StyleSheet, Text, View} from 'react-native'; diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverIndex.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverIndex.js index b4f4efa3ba1..2e71beaf427 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverIndex.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverIndex.js @@ -8,8 +8,8 @@ * @format */ -import * as IntersectionObserverMDNExample from './IntersectionObserverMDNExample'; import * as IntersectionObserverBenchmark from './IntersectionObserverBenchmark'; +import * as IntersectionObserverMDNExample from './IntersectionObserverMDNExample'; export const framework = 'React'; export const title = 'IntersectionObserver'; diff --git a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverMDNExample.js b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverMDNExample.js index 5a6efd67532..794a20f67ab 100644 --- a/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverMDNExample.js +++ b/packages/rn-tester/js/examples/IntersectionObserver/IntersectionObserverMDNExample.js @@ -9,14 +9,13 @@ */ import {RNTesterThemeContext} from '../../components/RNTesterTheme'; - import * as React from 'react'; import { + type ElementRef, + useContext, useLayoutEffect, useRef, useState, - type ElementRef, - useContext, } from 'react'; import {ScrollView, StyleSheet, Text, View} from 'react-native'; diff --git a/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js b/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js index 523dcb09847..886a1813bff 100644 --- a/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js +++ b/packages/rn-tester/js/examples/InvalidProps/InvalidPropsExample.js @@ -11,7 +11,6 @@ 'use strict'; import * as React from 'react'; - import {Text, View} from 'react-native'; export const title = 'Invalid Props'; diff --git a/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js b/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js index 49b35c9506a..4c96b146978 100644 --- a/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js +++ b/packages/rn-tester/js/examples/JSResponderHandlerExample/JSResponderHandlerExample.js @@ -8,12 +8,11 @@ * @flow strict-local */ -const React = require('react'); - -const {Text, View, StyleSheet} = require('react-native'); - import {PanResponder, ScrollView} from 'react-native'; +const React = require('react'); +const {StyleSheet, Text, View} = require('react-native'); + exports.displayName = 'JSResponderHandlerExample'; exports.framework = 'React'; exports.title = 'JSResponderHandler'; diff --git a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js index 400d5b3df83..6c20b165587 100644 --- a/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js +++ b/packages/rn-tester/js/examples/KeyboardAvoidingView/KeyboardAvoidingViewExample.js @@ -11,21 +11,20 @@ 'use strict'; const React = require('react'); +const {useState} = require('react'); const { Alert, + Button, KeyboardAvoidingView, Modal, + Pressable, StyleSheet, Text, TextInput, - Button, - Pressable, TouchableOpacity, View, } = require('react-native'); -const {useState} = require('react'); - const onButtonPress = () => { Alert.alert('Successfully Registered!'); }; diff --git a/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js b/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js index d3bd28b9a6b..9450f717d26 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutAnimationExample.js @@ -15,8 +15,8 @@ const { LayoutAnimation, StyleSheet, Text, - View, TouchableOpacity, + View, } = require('react-native'); type ExampleViewSpec = {| diff --git a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js index 016b0f6193e..72ca62e2b6c 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js @@ -10,8 +10,12 @@ 'use strict'; -const React = require('react'); +import type { + ViewLayout, + ViewLayoutEvent, +} from 'react-native/Libraries/Components/View/ViewPropTypes'; +const React = require('react'); const { Image, LayoutAnimation, @@ -20,11 +24,6 @@ const { View, } = require('react-native'); -import type { - ViewLayout, - ViewLayoutEvent, -} from 'react-native/Libraries/Components/View/ViewPropTypes'; - type Props = $ReadOnly<{||}>; type State = { containerStyle?: {|width: number|}, diff --git a/packages/rn-tester/js/examples/Layout/LayoutExample.js b/packages/rn-tester/js/examples/Layout/LayoutExample.js index ef7320c5258..8099362f6a3 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutExample.js @@ -13,7 +13,6 @@ const RNTesterBlock = require('../../components/RNTesterBlock'); const RNTesterPage = require('../../components/RNTesterPage'); const React = require('react'); - const {StyleSheet, Text, View} = require('react-native'); class Circle extends React.Component<$FlowFixMeProps> { diff --git a/packages/rn-tester/js/examples/Linking/LinkingExample.js b/packages/rn-tester/js/examples/Linking/LinkingExample.js index 2f84d7c5e0e..64e5e8e594c 100644 --- a/packages/rn-tester/js/examples/Linking/LinkingExample.js +++ b/packages/rn-tester/js/examples/Linking/LinkingExample.js @@ -9,6 +9,7 @@ 'use strict'; +const RNTesterBlock = require('../../components/RNTesterBlock'); const React = require('react'); const { Button, @@ -16,13 +17,11 @@ const { Platform, StyleSheet, Text, - TouchableOpacity, ToastAndroid, + TouchableOpacity, View, } = require('react-native'); -const RNTesterBlock = require('../../components/RNTesterBlock'); - type Props = $ReadOnly<{| url?: ?string, |}>; diff --git a/packages/rn-tester/js/examples/Modal/ModalExample.js b/packages/rn-tester/js/examples/Modal/ModalExample.js index d781cbc7d4c..c787bb4e870 100644 --- a/packages/rn-tester/js/examples/Modal/ModalExample.js +++ b/packages/rn-tester/js/examples/Modal/ModalExample.js @@ -8,10 +8,11 @@ * @format */ -import ModalPresentation from './ModalPresentation'; -import ModalOnShow from './ModalOnShow'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import ModalOnShow from './ModalOnShow'; +import ModalPresentation from './ModalPresentation'; + export const displayName = (undefined: ?string); export const framework = 'React'; export const title = 'Modal'; diff --git a/packages/rn-tester/js/examples/Modal/ModalOnShow.js b/packages/rn-tester/js/examples/Modal/ModalOnShow.js index 9c35229276b..8ef9764794a 100644 --- a/packages/rn-tester/js/examples/Modal/ModalOnShow.js +++ b/packages/rn-tester/js/examples/Modal/ModalOnShow.js @@ -8,9 +8,10 @@ * @format */ +import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; + import * as React from 'react'; import {Modal, Pressable, StyleSheet, Text, View} from 'react-native'; -import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; function ModalOnShowOnDismiss(): React.Node { const [modalShowComponent, setModalShowComponent] = React.useState(true); diff --git a/packages/rn-tester/js/examples/Modal/ModalPresentation.js b/packages/rn-tester/js/examples/Modal/ModalPresentation.js index 358da027e2b..e5f2cad774e 100644 --- a/packages/rn-tester/js/examples/Modal/ModalPresentation.js +++ b/packages/rn-tester/js/examples/Modal/ModalPresentation.js @@ -10,11 +10,13 @@ /* eslint-disable no-alert */ -import * as React from 'react'; -import {Modal, Platform, StyleSheet, Switch, Text, View} from 'react-native'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {Props as ModalProps} from 'react-native/Libraries/Modal/Modal'; + import RNTOption from '../../components/RNTOption'; +import * as React from 'react'; +import {Modal, Platform, StyleSheet, Switch, Text, View} from 'react-native'; + const RNTesterButton = require('../../components/RNTesterButton'); const animationTypes = ['slide', 'none', 'fade']; diff --git a/packages/rn-tester/js/examples/MutationObserver/MutationObserverExample.js b/packages/rn-tester/js/examples/MutationObserver/MutationObserverExample.js index 7a809d55af9..804a021fca8 100644 --- a/packages/rn-tester/js/examples/MutationObserver/MutationObserverExample.js +++ b/packages/rn-tester/js/examples/MutationObserver/MutationObserverExample.js @@ -11,11 +11,11 @@ import type ReadOnlyNode from 'react-native/Libraries/DOM/Nodes/ReadOnlyNode'; import type NodeList from 'react-native/Libraries/DOM/OldStyleCollections/NodeList'; -import ReadOnlyElement from 'react-native/Libraries/DOM/Nodes/ReadOnlyElement'; import {RNTesterThemeContext} from '../../components/RNTesterTheme'; import * as React from 'react'; import {type ElementRef, useContext, useEffect, useRef, useState} from 'react'; import {Pressable, ScrollView, StyleSheet, Text, View} from 'react-native'; +import ReadOnlyElement from 'react-native/Libraries/DOM/Nodes/ReadOnlyElement'; import MutationObserver from 'react-native/Libraries/MutationObserver/MutationObserver'; export const name = 'MutationObserver Example'; diff --git a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCOverlayExample.js b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCOverlayExample.js index d80db941054..17e9c47147f 100644 --- a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCOverlayExample.js +++ b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCOverlayExample.js @@ -9,8 +9,9 @@ */ import type VCTracker, {VisualElement} from './VCTrackerExample'; -import {useEffect, useState} from 'react'; + import * as React from 'react'; +import {useEffect, useState} from 'react'; import {Dimensions, StyleSheet, View} from 'react-native'; const OVERLAY_SCALE = 0.25; diff --git a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCTrackerExample.js b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCTrackerExample.js index 0de5a1b7f38..414eed58b2a 100644 --- a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCTrackerExample.js +++ b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VCTrackerExample.js @@ -11,9 +11,9 @@ import type DOMRectReadOnly from 'react-native/Libraries/DOM/Geometry/DOMRectReadOnly'; import type ReadOnlyNode from 'react-native/Libraries/DOM/Nodes/ReadOnlyNode'; +import ReactNativeElement from 'react-native/Libraries/DOM/Nodes/ReactNativeElement'; import IntersectionObserver from 'react-native/Libraries/IntersectionObserver/IntersectionObserver'; import MutationObserver from 'react-native/Libraries/MutationObserver/MutationObserver'; -import ReactNativeElement from 'react-native/Libraries/DOM/Nodes/ReactNativeElement'; export type VisualElement = { time: number, diff --git a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VisualCompletionExample.js b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VisualCompletionExample.js index f94b17816d7..f187082948f 100644 --- a/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VisualCompletionExample.js +++ b/packages/rn-tester/js/examples/MutationObserver/VisualCompletionExample/VisualCompletionExample.js @@ -8,10 +8,12 @@ * @format */ +import {RNTesterThemeContext} from '../../../components/RNTesterTheme'; +import VCOverlay from './VCOverlayExample'; +import VCTracker from './VCTrackerExample'; import nullthrows from 'nullthrows'; import * as React from 'react'; import {useContext, useEffect} from 'react'; -import {RNTesterThemeContext} from '../../../components/RNTesterTheme'; import { ActivityIndicator, ScrollView, @@ -20,8 +22,6 @@ import { View, } from 'react-native'; import ReactNativeElement from 'react-native/Libraries/DOM/Nodes/ReactNativeElement'; -import VCTracker from './VCTrackerExample'; -import VCOverlay from './VCOverlayExample'; export const name = 'Visual Completion Example'; export const title = name; diff --git a/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js b/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js index e4f7f4aba38..c380bebee96 100644 --- a/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js +++ b/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js @@ -12,17 +12,16 @@ import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue'; -const React = require('react'); - import RNTesterSettingSwitchRow from '../../components/RNTesterSettingSwitchRow'; import useJsStalls from '../../utils/useJsStalls'; +const React = require('react'); const { - View, - Text, Animated, StyleSheet, + Text, TouchableWithoutFeedback, + View, } = require('react-native'); class Tester extends React.Component<$FlowFixMeProps, $FlowFixMeState> { diff --git a/packages/rn-tester/js/examples/NewAppScreen/NewAppScreenExample.js b/packages/rn-tester/js/examples/NewAppScreen/NewAppScreenExample.js index 5d8be8bdf1e..4961fbe4177 100644 --- a/packages/rn-tester/js/examples/NewAppScreen/NewAppScreenExample.js +++ b/packages/rn-tester/js/examples/NewAppScreen/NewAppScreenExample.js @@ -13,10 +13,10 @@ const React = require('react'); const {View} = require('react-native'); const { - Header, - LearnMoreLinks, Colors, DebugInstructions, + Header, + LearnMoreLinks, ReloadInstructions, } = require('react-native/Libraries/NewAppScreen'); diff --git a/packages/rn-tester/js/examples/NewArchitecture/NewArchitectureExample.js b/packages/rn-tester/js/examples/NewArchitecture/NewArchitectureExample.js index 35ef0c41ad6..1c3d7ea68c9 100644 --- a/packages/rn-tester/js/examples/NewArchitecture/NewArchitectureExample.js +++ b/packages/rn-tester/js/examples/NewArchitecture/NewArchitectureExample.js @@ -10,8 +10,8 @@ 'use strict'; -import * as React from 'react'; import MyNativeView from '../../../NativeComponentExample/js/MyNativeView'; +import * as React from 'react'; exports.title = 'New Architecture Examples'; exports.description = diff --git a/packages/rn-tester/js/examples/OrientationChange/OrientationChangeExample.js b/packages/rn-tester/js/examples/OrientationChange/OrientationChangeExample.js index 16a7260d3e9..27ff257ea48 100644 --- a/packages/rn-tester/js/examples/OrientationChange/OrientationChangeExample.js +++ b/packages/rn-tester/js/examples/OrientationChange/OrientationChangeExample.js @@ -8,12 +8,11 @@ * @flow */ -const React = require('react'); - -const {DeviceEventEmitter, Text, View} = require('react-native'); - import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter'; +const React = require('react'); +const {DeviceEventEmitter, Text, View} = require('react-native'); + class OrientationChangeExample extends React.Component<{...}, $FlowFixMeState> { _orientationSubscription: EventSubscription; diff --git a/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js b/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js index 739abf633ab..5d7cfbd3209 100644 --- a/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js +++ b/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js @@ -10,16 +10,16 @@ 'use strict'; -const React = require('react'); -const {PanResponder, StyleSheet, View} = require('react-native'); -const RNTesterPage = require('../../components/RNTesterPage'); - import type { - PanResponderInstance, GestureState, + PanResponderInstance, } from 'react-native/Libraries/Interaction/PanResponder'; import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +const RNTesterPage = require('../../components/RNTesterPage'); +const React = require('react'); +const {PanResponder, StyleSheet, View} = require('react-native'); + type CircleStyles = { backgroundColor?: string, left?: number, diff --git a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js index d74358ee4ba..6c4e31726a0 100644 --- a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js +++ b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js @@ -13,9 +13,9 @@ import type MemoryInfo from 'react-native/Libraries/WebPerformance/MemoryInfo'; import type ReactNativeStartupTiming from 'react-native/Libraries/WebPerformance/ReactNativeStartupTiming'; -import * as React from 'react'; -import {StyleSheet, View, Text, Button} from 'react-native'; import RNTesterPage from '../../components/RNTesterPage'; +import * as React from 'react'; +import {Button, StyleSheet, Text, View} from 'react-native'; import Performance from 'react-native/Libraries/WebPerformance/Performance'; const {useState, useCallback} = React; diff --git a/packages/rn-tester/js/examples/Performance/PerformanceComparisonExample.js b/packages/rn-tester/js/examples/Performance/PerformanceComparisonExample.js index 93ab1824c75..896b8defbb8 100644 --- a/packages/rn-tester/js/examples/Performance/PerformanceComparisonExample.js +++ b/packages/rn-tester/js/examples/Performance/PerformanceComparisonExample.js @@ -11,13 +11,14 @@ 'use strict'; -import * as React from 'react'; -import {StyleSheet, View, Text} from 'react-native'; -import RNTesterPage from '../../components/RNTesterPage'; -import RNTesterButton from '../../components/RNTesterButton'; -import * as performanceComparisonExamples from './performanceComparisonExamples'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import RNTesterButton from '../../components/RNTesterButton'; +import RNTesterPage from '../../components/RNTesterPage'; +import * as performanceComparisonExamples from './performanceComparisonExamples'; +import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; + const {useState, useCallback, useMemo} = React; const SHOW_NOTHING = 'SHOW_NOTHING'; const SHOW_GOOD_EXAMPLE = 'SHOW_GOOD_EXAMPLE'; diff --git a/packages/rn-tester/js/examples/Performance/components/ItemList.js b/packages/rn-tester/js/examples/Performance/components/ItemList.js index 622b013906d..d28255d5bc3 100644 --- a/packages/rn-tester/js/examples/Performance/components/ItemList.js +++ b/packages/rn-tester/js/examples/Performance/components/ItemList.js @@ -11,11 +11,11 @@ 'use strict'; -import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import type {ItemDataType} from './itemData'; +import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; import * as React from 'react'; -import {StyleSheet, View, Text, FlatList, ScrollView} from 'react-native'; +import {FlatList, ScrollView, StyleSheet, Text, View} from 'react-native'; function Item(props: {data: ItemDataType}): React.Node { const {data} = props; diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/EffectInRenderExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/EffectInRenderExample.js index e35e42cc79c..0e795dc07bd 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/EffectInRenderExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/EffectInRenderExample.js @@ -13,11 +13,11 @@ import type {ItemDataType} from '../components/itemData'; -import * as React from 'react'; -import {useState, useEffect, useCallback, StrictMode} from 'react'; -import {Text} from 'react-native'; import {generateRandomItems} from '../components/itemData'; import ItemList from '../components/ItemList'; +import * as React from 'react'; +import {StrictMode, useCallback, useEffect, useState} from 'react'; +import {Text} from 'react-native'; const TIMEOUT = 500; const FETCH_COUNT = 250; diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/NotMemoizeExpensiveTaskExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/NotMemoizeExpensiveTaskExample.js index da54a78a8b4..4c81c639df4 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/NotMemoizeExpensiveTaskExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/NotMemoizeExpensiveTaskExample.js @@ -11,9 +11,9 @@ 'use strict'; +import RNTesterButton from '../../../components/RNTesterButton'; import * as React from 'react'; import {Text} from 'react-native'; -import RNTesterButton from '../../../components/RNTesterButton'; const {useState, useMemo} = React; diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js index 7ea36fcfb16..c481466ec98 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js @@ -11,11 +11,12 @@ 'use strict'; +import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; + +import {LIST_100_ITEMS} from '../components/itemData'; +import ItemList from '../components/ItemList'; import * as React from 'react'; import {Text} from 'react-native'; -import ItemList from '../components/ItemList'; -import {LIST_100_ITEMS} from '../components/itemData'; -import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; const {useCallback, useState} = React; const ItemListMemo = React.memo(ItemList); diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js index 5f5ab7354d3..9da14b10054 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js @@ -11,11 +11,12 @@ 'use strict'; +import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; + +import {LIST_100_ITEMS} from '../components/itemData'; +import ItemList from '../components/ItemList'; import * as React from 'react'; import {Text} from 'react-native'; -import ItemList from '../components/ItemList'; -import {LIST_100_ITEMS} from '../components/itemData'; -import type {ScrollEvent} from 'react-native/Libraries/Types/CoreEventTypes'; const {useState, useCallback} = React; const ItemListMemo = React.memo(ItemList); diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/RenderOffscreenContentExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/RenderOffscreenContentExample.js index cfc1f4e1a09..4a5a3a30580 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/RenderOffscreenContentExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/RenderOffscreenContentExample.js @@ -11,9 +11,9 @@ 'use strict'; -import * as React from 'react'; -import ItemList from '../components/ItemList'; import {LIST_100_ITEMS} from '../components/itemData'; +import ItemList from '../components/ItemList'; +import * as React from 'react'; const ItemListMemo = React.memo(ItemList); diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample.js index 07c7668bb44..d3acfffc03f 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample.js @@ -13,9 +13,9 @@ import type {ItemDataType} from '../components/itemData'; -import * as React from 'react'; -import ItemList from '../components/ItemList'; import {LIST_1000_ITEMS} from '../components/itemData'; +import ItemList from '../components/ItemList'; +import * as React from 'react'; const {useState, useEffect} = React; const ItemListMemo = React.memo(ItemList); diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample2.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample2.js index 07c7668bb44..d3acfffc03f 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample2.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/SetStateInWrongEffectExample2.js @@ -13,9 +13,9 @@ import type {ItemDataType} from '../components/itemData'; -import * as React from 'react'; -import ItemList from '../components/ItemList'; import {LIST_1000_ITEMS} from '../components/itemData'; +import ItemList from '../components/ItemList'; +import * as React from 'react'; const {useState, useEffect} = React; const ItemListMemo = React.memo(ItemList); diff --git a/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js b/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js index cd7f3035f93..5bd6dd8abf2 100644 --- a/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js +++ b/packages/rn-tester/js/examples/PermissionsAndroid/PermissionsExample.js @@ -10,11 +10,10 @@ 'use strict'; -import * as React from 'react'; - -import {PermissionsAndroid, StyleSheet, Text, View} from 'react-native'; -import RNTOption from '../../components/RNTOption'; import RNTesterButton from '../../components/RNTesterButton'; +import RNTOption from '../../components/RNTOption'; +import * as React from 'react'; +import {PermissionsAndroid, StyleSheet, Text, View} from 'react-native'; function PermissionsExample() { const [permission, setPermission] = React.useState( diff --git a/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js b/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js index 37535f520a1..2437e8509cb 100644 --- a/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js +++ b/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js @@ -8,9 +8,10 @@ * @flow */ +import Platform from 'react-native/Libraries/Utilities/Platform'; + const React = require('react'); const ReactNative = require('react-native'); -import Platform from 'react-native/Libraries/Utilities/Platform'; const {DynamicColorIOS, PlatformColor, StyleSheet, Text, View} = ReactNative; function PlatformColorsExample() { diff --git a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js index 069ac9384f0..f1f4b1ce14a 100644 --- a/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js +++ b/packages/rn-tester/js/examples/PointerEvents/PointerEventsExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {StyleSheet, Text, View} = require('react-native'); type ExampleBoxComponentProps = $ReadOnly<{| diff --git a/packages/rn-tester/js/examples/RTL/RTLExample.js b/packages/rn-tester/js/examples/RTL/RTLExample.js index 06eb6c9bbf7..a54e78ccad0 100644 --- a/packages/rn-tester/js/examples/RTL/RTLExample.js +++ b/packages/rn-tester/js/examples/RTL/RTLExample.js @@ -11,21 +11,20 @@ 'use strict'; const React = require('react'); - const { Alert, Animated, + Button, I18nManager, Image, PixelRatio, Platform, StyleSheet, + Switch, Text, TextInput, TouchableWithoutFeedback, - Switch, View, - Button, } = require('react-native'); type RTLToggleState = {isRTL: boolean, ...}; diff --git a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js index ce72ac8dd90..768945f1fc9 100644 --- a/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js +++ b/packages/rn-tester/js/examples/RefreshControl/RefreshControlExample.js @@ -11,9 +11,9 @@ const React = require('react'); const { + RefreshControl, ScrollView, StyleSheet, - RefreshControl, Text, TouchableWithoutFeedback, View, diff --git a/packages/rn-tester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js b/packages/rn-tester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js index d5f057edfd7..90337842ee7 100644 --- a/packages/rn-tester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js +++ b/packages/rn-tester/js/examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class RootViewSizeFlexibilityExampleApp extends React.Component< diff --git a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js index a57283becec..e4cba55160f 100644 --- a/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js +++ b/packages/rn-tester/js/examples/SafeAreaView/SafeAreaViewExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const { Button, DeviceInfo, diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsIOSExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsIOSExample.js index c76de6f7b6b..d820dfe904c 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsIOSExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsIOSExample.js @@ -8,7 +8,6 @@ 'use strict'; import * as React from 'react'; - import { Button, Modal, diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js index 04ace36d56c..95f64433aca 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsIOSExample.js @@ -8,10 +8,9 @@ 'use strict'; import * as React from 'react'; - import { - ScrollView, FlatList, + ScrollView, StyleSheet, Switch, Text, diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewSimpleExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewSimpleExample.js index d396a7a341e..8add97a844b 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewSimpleExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewSimpleExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const { ScrollView, StyleSheet, diff --git a/packages/rn-tester/js/examples/SectionList/SectionList-contentInset.js b/packages/rn-tester/js/examples/SectionList/SectionList-contentInset.js index 07e167fd11b..b71ee19aa8e 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionList-contentInset.js +++ b/packages/rn-tester/js/examples/SectionList/SectionList-contentInset.js @@ -11,7 +11,7 @@ 'use strict'; import SectionListBaseExample from './SectionListBaseExample'; import * as React from 'react'; -import {View, Text, StyleSheet} from 'react-native'; +import {StyleSheet, Text, View} from 'react-native'; export function SectionList_contentInset(): React.Node { const [initialContentInset, toggledContentInset] = [44, 88]; diff --git a/packages/rn-tester/js/examples/SectionList/SectionList-scrollable.js b/packages/rn-tester/js/examples/SectionList/SectionList-scrollable.js index b0039c98eb3..dc3a0c738bf 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionList-scrollable.js +++ b/packages/rn-tester/js/examples/SectionList/SectionList-scrollable.js @@ -10,14 +10,10 @@ 'use strict'; import type {Item} from '../../components/ListExampleShared'; -const RNTesterPage = require('../../components/RNTesterPage'); -const React = require('react'); - -const infoLog = require('react-native/Libraries/Utilities/infoLog'); const { - HeaderComponent, FooterComponent, + HeaderComponent, ItemComponent, PlainInput, SeparatorComponent, @@ -27,15 +23,18 @@ const { renderSmallSwitchOption, renderStackedItem, } = require('../../components/ListExampleShared'); +const RNTesterPage = require('../../components/RNTesterPage'); +const React = require('react'); const { Alert, Animated, Button, + SectionList, StyleSheet, Text, View, - SectionList, } = require('react-native'); +const infoLog = require('react-native/Libraries/Utilities/infoLog'); const VIEWABILITY_CONFIG = { minimumViewTime: 3000, diff --git a/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js b/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js index 8df947c8d93..1503cd6796b 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js +++ b/packages/rn-tester/js/examples/SectionList/SectionListBaseExample.js @@ -8,17 +8,16 @@ * @format */ +import * as React from 'react'; import { - Pressable, Button, + Pressable, SectionList, StyleSheet, Text, View, } from 'react-native'; -import * as React from 'react'; - const DATA = [ { title: 'Main dishes', diff --git a/packages/rn-tester/js/examples/SectionList/SectionListIndex.js b/packages/rn-tester/js/examples/SectionList/SectionListIndex.js index be5f472af5a..cf597b44f54 100644 --- a/packages/rn-tester/js/examples/SectionList/SectionListIndex.js +++ b/packages/rn-tester/js/examples/SectionList/SectionListIndex.js @@ -10,13 +10,13 @@ 'use strict'; -import Scrollable from './SectionList-scrollable'; import ContentInset from './SectionList-contentInset'; +import inverted from './SectionList-inverted'; import onEndReached from './SectionList-onEndReached'; import onViewableItemsChanged from './SectionList-onViewableItemsChanged'; -import withSeparators from './SectionList-withSeparators'; +import Scrollable from './SectionList-scrollable'; import stickyHeadersEnabled from './SectionList-stickyHeadersEnabled'; -import inverted from './SectionList-inverted'; +import withSeparators from './SectionList-withSeparators'; exports.title = 'SectionList'; exports.category = 'ListView'; diff --git a/packages/rn-tester/js/examples/SetPropertiesExample/SetPropertiesExampleApp.js b/packages/rn-tester/js/examples/SetPropertiesExample/SetPropertiesExampleApp.js index 080cf109f19..2fd76f0a9d4 100644 --- a/packages/rn-tester/js/examples/SetPropertiesExample/SetPropertiesExampleApp.js +++ b/packages/rn-tester/js/examples/SetPropertiesExample/SetPropertiesExampleApp.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {Text, View} = require('react-native'); class SetPropertiesExampleApp extends React.Component<$FlowFixMeProps> { diff --git a/packages/rn-tester/js/examples/Share/ShareExample.js b/packages/rn-tester/js/examples/Share/ShareExample.js index af4790ccebb..fb81297ca9f 100644 --- a/packages/rn-tester/js/examples/Share/ShareExample.js +++ b/packages/rn-tester/js/examples/Share/ShareExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); - -const {StyleSheet, View, Text, Button, Share} = require('react-native'); +const {Button, Share, StyleSheet, Text, View} = require('react-native'); const shareMessage = () => { // $FlowFixMe[unused-promise] diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js b/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js index df15929e706..e46183beeb6 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js @@ -10,9 +10,9 @@ 'use strict'; +const ScreenshotManager = require('../../../NativeModuleExample/NativeScreenshotManager'); const React = require('react'); const {Alert, Image, StyleSheet, Text, View} = require('react-native'); -const ScreenshotManager = require('../../../NativeModuleExample/NativeScreenshotManager'); class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> { state: any | {uri: void} = { diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js index 5bc21379e91..c35c47e6c38 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js @@ -10,15 +10,14 @@ 'use strict'; -const React = require('react'); +import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; +import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; +const React = require('react'); const {NativeModules, StyleSheet, UIManager, View} = require('react-native'); const {TestModule} = NativeModules; -import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; - // Verify that RCTSnapshot is part of the UIManager since it is only loaded // if you have linked against RCTTest like in tests, otherwise we will have // a warning printed out diff --git a/packages/rn-tester/js/examples/StatusBar/StatusBarExample.js b/packages/rn-tester/js/examples/StatusBar/StatusBarExample.js index 16aa1c42e61..7b0f94e2f4a 100644 --- a/packages/rn-tester/js/examples/StatusBar/StatusBarExample.js +++ b/packages/rn-tester/js/examples/StatusBar/StatusBarExample.js @@ -11,14 +11,13 @@ 'use strict'; const React = require('react'); - const { + Modal, StatusBar, StyleSheet, Text, TouchableHighlight, View, - Modal, } = require('react-native'); const colors = ['#ff0000', '#00ff00', '#0000ff', 'rgba(0, 0, 0, 0.4)']; diff --git a/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js b/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js index 41ff93ac454..289f0480733 100644 --- a/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js +++ b/packages/rn-tester/js/examples/SwipeableCardExample/SwipeableCardExample.js @@ -13,11 +13,11 @@ import type {RenderItemProps} from 'react-native/Libraries/Lists/VirtualizedList import * as React from 'react'; import { Animated, - PanResponder, - View, - StyleSheet, FlatList, + PanResponder, + StyleSheet, Text, + View, useWindowDimensions, } from 'react-native'; diff --git a/packages/rn-tester/js/examples/Switch/SwitchExample.js b/packages/rn-tester/js/examples/Switch/SwitchExample.js index 3f0056576f1..cdc8fb1baed 100644 --- a/packages/rn-tester/js/examples/Switch/SwitchExample.js +++ b/packages/rn-tester/js/examples/Switch/SwitchExample.js @@ -11,7 +11,7 @@ 'use strict'; const React = require('react'); -const {Switch, Text, View, Platform} = require('react-native'); +const {Platform, Switch, Text, View} = require('react-native'); type OnOffIndicatorProps = $ReadOnly<{|on: boolean, testID: string|}>; function OnOffIndicator({on, testID}: OnOffIndicatorProps) { diff --git a/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js b/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js index cf74027259a..b11e72f00f3 100644 --- a/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js +++ b/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js @@ -8,9 +8,9 @@ * @flow strict-local */ -import {Button, Text, StyleSheet, View} from 'react-native'; import * as React from 'react'; import {useState} from 'react'; +import {Button, StyleSheet, Text, View} from 'react-native'; export default function TextAdjustsDynamicLayoutExample(props: {}): React.Node { const [height, setHeight] = useState(20); diff --git a/packages/rn-tester/js/examples/Text/TextExample.android.js b/packages/rn-tester/js/examples/Text/TextExample.android.js index a5e8966f15c..94e67090342 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.android.js +++ b/packages/rn-tester/js/examples/Text/TextExample.android.js @@ -11,14 +11,14 @@ 'use strict'; import type {RNTesterModule} from '../../types/RNTesterTypes'; + +import TextLegend from '../../components/TextLegend'; import TextAdjustsDynamicLayoutExample from './TextAdjustsDynamicLayoutExample'; const RNTesterBlock = require('../../components/RNTesterBlock'); const RNTesterPage = require('../../components/RNTesterPage'); -const React = require('react'); const TextInlineView = require('../../components/TextInlineView'); -import TextLegend from '../../components/TextLegend'; - +const React = require('react'); const {LayoutAnimation, StyleSheet, Text, View} = require('react-native'); class Entity extends React.Component<{|children: React.Node|}> { diff --git a/packages/rn-tester/js/examples/Text/TextExample.ios.js b/packages/rn-tester/js/examples/Text/TextExample.ios.js index 473c9411a86..2932da5092f 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.ios.js +++ b/packages/rn-tester/js/examples/Text/TextExample.ios.js @@ -12,11 +12,10 @@ import type {RNTesterModule} from '../../types/RNTesterTypes'; -const React = require('react'); -const TextAncestor = require('react-native/Libraries/Text/TextAncestor'); -const TextInlineView = require('../../components/TextInlineView'); import TextLegend from '../../components/TextLegend'; +const TextInlineView = require('../../components/TextInlineView'); +const React = require('react'); const { Button, LayoutAnimation, @@ -25,6 +24,7 @@ const { TextInput, View, } = require('react-native'); +const TextAncestor = require('react-native/Libraries/Text/TextAncestor'); // TODO: Is there a cleaner way to flip the TextAncestor value to false? I // suspect apps won't even be able to leverage this workaround because diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js index 74f516fd0e6..d0ad8661558 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.android.js @@ -10,17 +10,15 @@ 'use strict'; -const React = require('react'); - -const {Text, TextInput, View, StyleSheet, Switch} = require('react-native'); - -const TextInputSharedExamples = require('./TextInputSharedExamples.js'); - import type { RNTesterModule, RNTesterModuleExample, } from '../../types/RNTesterTypes'; +const TextInputSharedExamples = require('./TextInputSharedExamples.js'); +const React = require('react'); +const {StyleSheet, Switch, Text, TextInput, View} = require('react-native'); + class ToggleDefaultPaddingExample extends React.Component< $FlowFixMeProps, $FlowFixMeState, diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index ef048e100af..da496b20598 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -10,26 +10,24 @@ 'use strict'; -const React = require('react'); - -const { - Button, - InputAccessoryView, - Text, - TextInput, - View, - StyleSheet, - Switch, - Alert, -} = require('react-native'); -import type {KeyboardType} from 'react-native/Libraries/Components/TextInput/TextInput'; - -const TextInputSharedExamples = require('./TextInputSharedExamples.js'); - import type { RNTesterModule, RNTesterModuleExample, } from '../../types/RNTesterTypes'; +import type {KeyboardType} from 'react-native/Libraries/Components/TextInput/TextInput'; + +const TextInputSharedExamples = require('./TextInputSharedExamples.js'); +const React = require('react'); +const { + Alert, + Button, + InputAccessoryView, + StyleSheet, + Switch, + Text, + TextInput, + View, +} = require('react-native'); class WithLabel extends React.Component<$FlowFixMeProps> { render(): React.Node { diff --git a/packages/rn-tester/js/examples/TextInput/TextInputKeyProp.js b/packages/rn-tester/js/examples/TextInput/TextInputKeyProp.js index 53d94e46aaf..58a2ab3552b 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputKeyProp.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputKeyProp.js @@ -11,7 +11,7 @@ 'use strict'; const React = require('react'); -const {View, TextInput} = require('react-native'); +const {TextInput, View} = require('react-native'); const {useEffect, useState} = React; function TextInputKeyProp() { diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index c05948b0639..d03a0b9a33a 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -10,21 +10,21 @@ 'use strict'; +import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; +import type {TextStyle} from 'react-native/Libraries/StyleSheet/StyleSheet'; + +import RNTesterButton from '../../components/RNTesterButton'; +import {RNTesterThemeContext} from '../../components/RNTesterTheme'; import * as React from 'react'; import {useContext, useState} from 'react'; import { Button, Platform, + StyleSheet, Text, TextInput, View, - StyleSheet, } from 'react-native'; -import type {TextStyle} from 'react-native/Libraries/StyleSheet/StyleSheet'; - -import RNTesterButton from '../../components/RNTesterButton'; -import {RNTesterThemeContext} from '../../components/RNTesterTheme'; -import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; const styles = StyleSheet.create({ default: { diff --git a/packages/rn-tester/js/examples/Timer/TimerExample.js b/packages/rn-tester/js/examples/Timer/TimerExample.js index 166674d31aa..ddcd9d99ffe 100644 --- a/packages/rn-tester/js/examples/Timer/TimerExample.js +++ b/packages/rn-tester/js/examples/Timer/TimerExample.js @@ -12,8 +12,7 @@ const RNTesterButton = require('../../components/RNTesterButton'); const React = require('react'); - -const {Alert, Platform, ToastAndroid, Text, View} = require('react-native'); +const {Alert, Platform, Text, ToastAndroid, View} = require('react-native'); function burnCPU(milliseconds: number) { const start = global.performance.now(); diff --git a/packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.js b/packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.js index b158924fae0..03366f4fbc2 100644 --- a/packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.js +++ b/packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); - -const {StyleSheet, Text, ToastAndroid, Pressable} = require('react-native'); +const {Pressable, StyleSheet, Text, ToastAndroid} = require('react-native'); const ToastWithShortDuration = () => { return ( diff --git a/packages/rn-tester/js/examples/Touchable/TouchableExample.js b/packages/rn-tester/js/examples/Touchable/TouchableExample.js index 8242039d797..4f978e9d599 100644 --- a/packages/rn-tester/js/examples/Touchable/TouchableExample.js +++ b/packages/rn-tester/js/examples/Touchable/TouchableExample.js @@ -8,23 +8,22 @@ * @flow */ -const React = require('react'); +import {useEffect, useRef, useState} from 'react'; +const React = require('react'); const { Animated, Image, + Platform, StyleSheet, Text, TouchableHighlight, - TouchableOpacity, - Platform, TouchableNativeFeedback, + TouchableOpacity, TouchableWithoutFeedback, View, } = require('react-native'); -import {useEffect, useRef, useState} from 'react'; - const forceTouchAvailable = (Platform.OS === 'ios' && Platform.constants.forceTouchAvailable) || false; diff --git a/packages/rn-tester/js/examples/Transform/TransformExample.js b/packages/rn-tester/js/examples/Transform/TransformExample.js index 48ac0e0e4be..7741baff11d 100644 --- a/packages/rn-tester/js/examples/Transform/TransformExample.js +++ b/packages/rn-tester/js/examples/Transform/TransformExample.js @@ -8,10 +8,10 @@ * @flow */ -import React, {useEffect, useState} from 'react'; -import {Animated, StyleSheet, Text, View, Easing} from 'react-native'; +import type {Element, Node} from 'react'; -import type {Node, Element} from 'react'; +import React, {useEffect, useState} from 'react'; +import {Animated, Easing, StyleSheet, Text, View} from 'react-native'; function AnimateTransformSingleProp() { const [theta] = useState(new Animated.Value(45)); diff --git a/packages/rn-tester/js/examples/TransparentHitTest/TransparentHitTestExample.js b/packages/rn-tester/js/examples/TransparentHitTest/TransparentHitTestExample.js index cf9885d2520..6419d40e861 100644 --- a/packages/rn-tester/js/examples/TransparentHitTest/TransparentHitTestExample.js +++ b/packages/rn-tester/js/examples/TransparentHitTest/TransparentHitTestExample.js @@ -11,7 +11,7 @@ 'use strict'; const React = require('react'); -const {Text, View, TouchableOpacity, Alert} = require('react-native'); +const {Alert, Text, TouchableOpacity, View} = require('react-native'); class TransparentHitTestExample extends React.Component<{...}> { render(): React.Node { diff --git a/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js b/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js index 65d269e4aa7..93708115af4 100644 --- a/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/LegacyModuleExample.js @@ -10,10 +10,10 @@ 'use strict'; -const React = require('react'); const { default: SampleLegacyModuleExample, } = require('./SampleLegacyModuleExample'); +const React = require('react'); exports.displayName = (undefined: ?string); exports.title = 'Legacy Native Module'; diff --git a/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js b/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js index 3aeb55e8040..b277a26f068 100644 --- a/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/NativeCxxModuleExampleExample.js @@ -10,21 +10,20 @@ import type {RootTag} from 'react-native/Libraries/ReactNative/RootTag'; -import { - DeviceEventEmitter, - Text, - View, - FlatList, - TouchableOpacity, - RootTagContext, -} from 'react-native'; -import * as React from 'react'; import NativeCxxModuleExample, { EnumInt, EnumNone, } from '../../../NativeCxxModuleExample/NativeCxxModuleExample'; - import styles from './TurboModuleExampleCommon'; +import * as React from 'react'; +import { + DeviceEventEmitter, + FlatList, + RootTagContext, + Text, + TouchableOpacity, + View, +} from 'react-native'; type State = {| testResults: { diff --git a/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js b/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js index 30194a48813..79ca96d27c5 100644 --- a/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/SampleLegacyModuleExample.js @@ -10,19 +10,18 @@ import type {RootTag} from 'react-native/Libraries/ReactNative/RootTag'; +import styles from './TurboModuleExampleCommon'; import * as React from 'react'; import { FlatList, NativeModules, + Platform, RootTagContext, Text, TouchableOpacity, View, - Platform, } from 'react-native'; -import styles from './TurboModuleExampleCommon'; - type State = {| testResults: { [string]: { diff --git a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js index 283c557bb2a..7e3a979ec5b 100644 --- a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js @@ -8,19 +8,19 @@ * @flow strict-local */ -import NativeSampleTurboModule from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; -import {EnumInt} from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; import type {RootTag} from 'react-native/Libraries/ReactNative/RootTag'; -import { - Text, - View, - FlatList, - TouchableOpacity, - RootTagContext, -} from 'react-native'; import styles from './TurboModuleExampleCommon'; import * as React from 'react'; +import { + FlatList, + RootTagContext, + Text, + TouchableOpacity, + View, +} from 'react-native'; +import NativeSampleTurboModule from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; +import {EnumInt} from 'react-native/Libraries/TurboModule/samples/NativeSampleTurboModule'; type State = {| testResults: { diff --git a/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js b/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js index 18e9f53ae24..6d60192de7c 100644 --- a/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/TurboCxxModuleExample.js @@ -10,8 +10,8 @@ 'use strict'; -const React = require('react'); const NativeCxxModuleExampleExample = require('./NativeCxxModuleExampleExample'); +const React = require('react'); exports.displayName = (undefined: ?string); exports.title = 'Cxx TurboModule'; diff --git a/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js b/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js index e177529316a..f70d00b85bd 100644 --- a/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/TurboModuleExample.js @@ -10,8 +10,8 @@ 'use strict'; -const React = require('react'); const SampleTurboModuleExample = require('./SampleTurboModuleExample'); +const React = require('react'); exports.displayName = (undefined: ?string); exports.title = 'TurboModule'; diff --git a/packages/rn-tester/js/examples/Vibration/VibrationExample.js b/packages/rn-tester/js/examples/Vibration/VibrationExample.js index bcc08ca2909..cb0371fe653 100644 --- a/packages/rn-tester/js/examples/Vibration/VibrationExample.js +++ b/packages/rn-tester/js/examples/Vibration/VibrationExample.js @@ -11,14 +11,13 @@ 'use strict'; const React = require('react'); - const { + Platform, StyleSheet, - View, Text, TouchableHighlight, Vibration, - Platform, + View, } = require('react-native'); exports.framework = 'React'; diff --git a/packages/rn-tester/js/examples/View/ViewExample.js b/packages/rn-tester/js/examples/View/ViewExample.js index bd278ccd7ed..944037e5e16 100644 --- a/packages/rn-tester/js/examples/View/ViewExample.js +++ b/packages/rn-tester/js/examples/View/ViewExample.js @@ -11,13 +11,14 @@ 'use strict'; import type {RNTesterModule} from '../../types/RNTesterTypes'; + import * as React from 'react'; import { + Platform, StyleSheet, Text, TouchableWithoutFeedback, View, - Platform, } from 'react-native'; class ViewBorderStyleExample extends React.Component< diff --git a/packages/rn-tester/js/examples/WebSocket/websocket_test_server.js b/packages/rn-tester/js/examples/WebSocket/websocket_test_server.js index cab8088c377..727ac0eba4e 100755 --- a/packages/rn-tester/js/examples/WebSocket/websocket_test_server.js +++ b/packages/rn-tester/js/examples/WebSocket/websocket_test_server.js @@ -13,10 +13,9 @@ /* eslint-env node */ -const WebSocket = require('ws'); - const fs = require('fs'); const path = require('path'); +const WebSocket = require('ws'); console.log(`\ Test server for WebSocketExample diff --git a/packages/rn-tester/js/examples/XHR/XHRExample.js b/packages/rn-tester/js/examples/XHR/XHRExample.js index 472c94ba8cc..d27394caa65 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExample.js +++ b/packages/rn-tester/js/examples/XHR/XHRExample.js @@ -10,13 +10,13 @@ 'use strict'; -const React = require('react'); const XHRExampleAbortController = require('./XHRExampleAbortController'); const XHRExampleBinaryUpload = require('./XHRExampleBinaryUpload'); const XHRExampleDownload = require('./XHRExampleDownload'); const XHRExampleFetch = require('./XHRExampleFetch'); const XHRExampleHeaders = require('./XHRExampleHeaders'); const XHRExampleOnTimeOut = require('./XHRExampleOnTimeOut'); +const React = require('react'); exports.framework = 'React'; exports.title = 'XMLHttpRequest'; diff --git a/packages/rn-tester/js/examples/XHR/XHRExampleAbortController.js b/packages/rn-tester/js/examples/XHR/XHRExampleAbortController.js index 391c825c0eb..b754e0a24ea 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExampleAbortController.js +++ b/packages/rn-tester/js/examples/XHR/XHRExampleAbortController.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {Alert, Button, View} = require('react-native'); class XHRExampleAbortController extends React.Component<{...}, {...}> { diff --git a/packages/rn-tester/js/examples/XHR/XHRExampleBinaryUpload.js b/packages/rn-tester/js/examples/XHR/XHRExampleBinaryUpload.js index 913f5772693..aabc2311a39 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExampleBinaryUpload.js +++ b/packages/rn-tester/js/examples/XHR/XHRExampleBinaryUpload.js @@ -10,8 +10,9 @@ 'use strict'; -const React = require('react'); +import RNTOption from '../../components/RNTOption'; +const React = require('react'); const { Alert, Linking, @@ -20,7 +21,6 @@ const { TouchableHighlight, View, } = require('react-native'); -import RNTOption from '../../components/RNTOption'; const BINARY_TYPES = { String, diff --git a/packages/rn-tester/js/examples/XHR/XHRExampleDownload.js b/packages/rn-tester/js/examples/XHR/XHRExampleDownload.js index e8512f1b76f..e021cb06f1a 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExampleDownload.js +++ b/packages/rn-tester/js/examples/XHR/XHRExampleDownload.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const { Alert, StyleSheet, diff --git a/packages/rn-tester/js/examples/XHR/XHRExampleFetch.js b/packages/rn-tester/js/examples/XHR/XHRExampleFetch.js index 478adb6a282..5d386d5ba58 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExampleFetch.js +++ b/packages/rn-tester/js/examples/XHR/XHRExampleFetch.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); - -const {StyleSheet, Text, TextInput, View, Platform} = require('react-native'); +const {Platform, StyleSheet, Text, TextInput, View} = require('react-native'); class XHRExampleFetch extends React.Component { responseURL: ?string; diff --git a/packages/rn-tester/js/examples/XHR/XHRExampleOnTimeOut.js b/packages/rn-tester/js/examples/XHR/XHRExampleOnTimeOut.js index 90f5d686ca1..f549b61512b 100644 --- a/packages/rn-tester/js/examples/XHR/XHRExampleOnTimeOut.js +++ b/packages/rn-tester/js/examples/XHR/XHRExampleOnTimeOut.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); - const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class XHRExampleOnTimeOut extends React.Component { diff --git a/packages/rn-tester/js/utils/RNTesterNavigationReducer.js b/packages/rn-tester/js/utils/RNTesterNavigationReducer.js index a21aa40dfe6..9c2097d668c 100644 --- a/packages/rn-tester/js/utils/RNTesterNavigationReducer.js +++ b/packages/rn-tester/js/utils/RNTesterNavigationReducer.js @@ -9,8 +9,8 @@ */ import type { - RNTesterNavigationState, ComponentList, + RNTesterNavigationState, } from '../types/RNTesterTypes'; export const RNTesterNavigationActionsType = { diff --git a/packages/rn-tester/js/utils/useJsStalls.js b/packages/rn-tester/js/utils/useJsStalls.js index 9729cd0a651..5ceac1505d2 100644 --- a/packages/rn-tester/js/utils/useJsStalls.js +++ b/packages/rn-tester/js/utils/useJsStalls.js @@ -8,10 +8,10 @@ * @flow strict-local */ -import * as React from 'react'; - import type {RNTesterJsStallsState} from '../types/RNTesterTypes'; +import * as React from 'react'; + const INITIAL_STATE: RNTesterJsStallsState = { stallIntervalId: null, busyTime: null, diff --git a/packages/virtualized-lists/Lists/FillRateHelper.js b/packages/virtualized-lists/Lists/FillRateHelper.js index c5bfadf962c..924b3531632 100644 --- a/packages/virtualized-lists/Lists/FillRateHelper.js +++ b/packages/virtualized-lists/Lists/FillRateHelper.js @@ -11,6 +11,7 @@ 'use strict'; import type {CellMetricProps} from './ListMetricsAggregator'; + import ListMetricsAggregator from './ListMetricsAggregator'; export type FillRateInfo = Info; diff --git a/packages/virtualized-lists/Lists/ListMetricsAggregator.js b/packages/virtualized-lists/Lists/ListMetricsAggregator.js index 01d6e5aff29..a7972390211 100644 --- a/packages/virtualized-lists/Lists/ListMetricsAggregator.js +++ b/packages/virtualized-lists/Lists/ListMetricsAggregator.js @@ -8,10 +8,10 @@ * @format */ -import type {Layout} from 'react-native/Libraries/Types/CoreEventTypes'; import type {Props as VirtualizedListProps} from './VirtualizedListProps'; -import {keyExtractor as defaultKeyExtractor} from './VirtualizeUtils'; +import type {Layout} from 'react-native/Libraries/Types/CoreEventTypes'; +import {keyExtractor as defaultKeyExtractor} from './VirtualizeUtils'; import invariant from 'invariant'; export type CellMetrics = { diff --git a/packages/virtualized-lists/Lists/ViewabilityHelper.js b/packages/virtualized-lists/Lists/ViewabilityHelper.js index f210b030d09..326641d54e2 100644 --- a/packages/virtualized-lists/Lists/ViewabilityHelper.js +++ b/packages/virtualized-lists/Lists/ViewabilityHelper.js @@ -11,6 +11,7 @@ 'use strict'; import type {CellMetricProps} from './ListMetricsAggregator'; + import ListMetricsAggregator from './ListMetricsAggregator'; const invariant = require('invariant'); diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index f257a0dc585..a6a0a2ad93a 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -8,12 +8,7 @@ * @format */ -import type {ScrollResponderType} from 'react-native/Libraries/Components/ScrollView/ScrollView'; -import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; -import type { - LayoutEvent, - ScrollEvent, -} from 'react-native/Libraries/Types/CoreEventTypes'; +import type {CellMetricProps, ListOrientation} from './ListMetricsAggregator'; import type {ViewToken} from './ViewabilityHelper'; import type { Item, @@ -22,17 +17,13 @@ import type { RenderItemType, Separators, } from './VirtualizedListProps'; -import type {CellMetricProps, ListOrientation} from './ListMetricsAggregator'; +import type {ScrollResponderType} from 'react-native/Libraries/Components/ScrollView/ScrollView'; +import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type { + LayoutEvent, + ScrollEvent, +} from 'react-native/Libraries/Types/CoreEventTypes'; -import { - I18nManager, - Platform, - RefreshControl, - ScrollView, - View, - StyleSheet, - findNodeHandle, -} from 'react-native'; import Batchinator from '../Interaction/Batchinator'; import clamp from '../Utilities/clamp'; import infoLog from '../Utilities/infoLog'; @@ -48,6 +39,14 @@ import { VirtualizedListContext, VirtualizedListContextProvider, } from './VirtualizedListContext.js'; +import { + horizontalOrDefault, + initialNumToRenderOrDefault, + maxToRenderPerBatchOrDefault, + onEndReachedThresholdOrDefault, + onStartReachedThresholdOrDefault, + windowSizeOrDefault, +} from './VirtualizedListProps'; import { computeWindowedRenderLimits, keyExtractor as defaultKeyExtractor, @@ -55,15 +54,15 @@ import { import invariant from 'invariant'; import nullthrows from 'nullthrows'; import * as React from 'react'; - import { - horizontalOrDefault, - initialNumToRenderOrDefault, - maxToRenderPerBatchOrDefault, - onStartReachedThresholdOrDefault, - onEndReachedThresholdOrDefault, - windowSizeOrDefault, -} from './VirtualizedListProps'; + I18nManager, + Platform, + RefreshControl, + ScrollView, + StyleSheet, + View, + findNodeHandle, +} from 'react-native'; export type {RenderItemProps, RenderItemType, Separators}; diff --git a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js index c4295c0ed93..953e884afde 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js +++ b/packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js @@ -8,17 +8,17 @@ * @format */ +import type {CellRendererProps, RenderItemType} from './VirtualizedListProps'; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { FocusEvent, LayoutEvent, } from 'react-native/Libraries/Types/CoreEventTypes'; -import type {CellRendererProps, RenderItemType} from './VirtualizedListProps'; -import {View, StyleSheet} from 'react-native'; import {VirtualizedListCellContextProvider} from './VirtualizedListContext.js'; import invariant from 'invariant'; import * as React from 'react'; +import {StyleSheet, View} from 'react-native'; export type Props = { CellRendererComponent?: ?React.ComponentType>, diff --git a/packages/virtualized-lists/Lists/VirtualizedListProps.js b/packages/virtualized-lists/Lists/VirtualizedListProps.js index 5d8b0cd0bb4..1a956ea64ca 100644 --- a/packages/virtualized-lists/Lists/VirtualizedListProps.js +++ b/packages/virtualized-lists/Lists/VirtualizedListProps.js @@ -8,19 +8,19 @@ * @format */ -import {typeof ScrollView} from 'react-native'; -import type { - FocusEvent, - LayoutEvent, -} from 'react-native/Libraries/Types/CoreEventTypes'; -import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import type { ViewabilityConfig, ViewabilityConfigCallbackPair, ViewToken, } from './ViewabilityHelper'; +import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; +import type { + FocusEvent, + LayoutEvent, +} from 'react-native/Libraries/Types/CoreEventTypes'; import * as React from 'react'; +import {typeof ScrollView} from 'react-native'; export type Item = any; diff --git a/packages/virtualized-lists/Lists/VirtualizedSectionList.js b/packages/virtualized-lists/Lists/VirtualizedSectionList.js index 0f6b2a360b3..220fc89cfc7 100644 --- a/packages/virtualized-lists/Lists/VirtualizedSectionList.js +++ b/packages/virtualized-lists/Lists/VirtualizedSectionList.js @@ -10,11 +10,11 @@ import type {ViewToken} from './ViewabilityHelper'; -import {View} from 'react-native'; import VirtualizedList from './VirtualizedList'; import {keyExtractor as defaultKeyExtractor} from './VirtualizeUtils'; import invariant from 'invariant'; import * as React from 'react'; +import {View} from 'react-native'; type Item = any; diff --git a/packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js b/packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js index da2bb5df90f..2278ca9e50c 100644 --- a/packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js +++ b/packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js @@ -11,7 +11,6 @@ import type {CellMetricProps} from '../ListMetricsAggregator'; import ListMetricsAggregator from '../ListMetricsAggregator'; - import nullthrows from 'nullthrows'; describe('ListMetricsAggregator', () => { diff --git a/packages/virtualized-lists/index.js b/packages/virtualized-lists/index.js index 31c196ba5e4..977dd1db499 100644 --- a/packages/virtualized-lists/index.js +++ b/packages/virtualized-lists/index.js @@ -10,13 +10,13 @@ 'use strict'; -import {keyExtractor} from './Lists/VirtualizeUtils'; - +import typeof FillRateHelper from './Lists/FillRateHelper'; +import typeof ViewabilityHelper from './Lists/ViewabilityHelper'; import typeof VirtualizedList from './Lists/VirtualizedList'; import typeof VirtualizedSectionList from './Lists/VirtualizedSectionList'; + import {typeof VirtualizedListContextResetter} from './Lists/VirtualizedListContext'; -import typeof ViewabilityHelper from './Lists/ViewabilityHelper'; -import typeof FillRateHelper from './Lists/FillRateHelper'; +import {keyExtractor} from './Lists/VirtualizeUtils'; export type { ViewToken, diff --git a/scripts/__tests__/npm-utils-test.js b/scripts/__tests__/npm-utils-test.js index f61f18693c5..0bacc5a0589 100644 --- a/scripts/__tests__/npm-utils-test.js +++ b/scripts/__tests__/npm-utils-test.js @@ -9,9 +9,9 @@ const { applyPackageVersions, + getNpmInfo, getPackageVersionStrByTag, publishPackage, - getNpmInfo, } = require('../npm-utils'); const execMock = jest.fn(); diff --git a/scripts/__tests__/scm-utils-test.js b/scripts/__tests__/scm-utils-test.js index 46db3361fd2..e1c000eaaad 100644 --- a/scripts/__tests__/scm-utils-test.js +++ b/scripts/__tests__/scm-utils-test.js @@ -7,7 +7,7 @@ * @format */ -const {isTaggedLatest, saveFiles, revertFiles} = require('../scm-utils'); +const {isTaggedLatest, revertFiles, saveFiles} = require('../scm-utils'); let execResult = null; const cpMock = jest.fn(); diff --git a/scripts/__tests__/version-utils-test.js b/scripts/__tests__/version-utils-test.js index 75868aeb8df..86fac6bd644 100644 --- a/scripts/__tests__/version-utils-test.js +++ b/scripts/__tests__/version-utils-test.js @@ -8,10 +8,10 @@ */ const { - parseVersion, - isReleaseBranch, - validateBuildType, isNightly, + isReleaseBranch, + parseVersion, + validateBuildType, } = require('../version-utils'); let execResult = null; diff --git a/scripts/android-e2e-test.js b/scripts/android-e2e-test.js index ad04d6323a1..6af641d56ce 100644 --- a/scripts/android-e2e-test.js +++ b/scripts/android-e2e-test.js @@ -32,10 +32,10 @@ 'use strict'; -const wd = require('wd'); -const path = require('path'); const fs = require('fs'); +const path = require('path'); const pd = require('pretty-data2').pd; +const wd = require('wd'); // value in ms to print out screen contents, set this value in CI to debug if tests are failing const appiumDebugInterval = process.env.APPIUM_DEBUG_INTERVAL; diff --git a/scripts/build/babel-register.js b/scripts/build/babel-register.js index 881cf6d1608..a9f99c4fdb4 100644 --- a/scripts/build/babel-register.js +++ b/scripts/build/babel-register.js @@ -9,9 +9,9 @@ * @oncall react_native */ -const path = require('path'); const {PACKAGES_DIR} = require('./build'); const {buildConfig, getBabelConfig} = require('./config'); +const path = require('path'); let isRegisteredForMonorepo = false; diff --git a/scripts/build/build.js b/scripts/build/build.js index 13c1224d536..52733861f0f 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -9,22 +9,22 @@ * @oncall react_native */ -const babel = require('@babel/core'); -const {parseArgs} = require('@pkgjs/parseargs'); -const chalk = require('chalk'); -const translate = require('flow-api-translator'); -const glob = require('glob'); -const micromatch = require('micromatch'); -const {promises: fs} = require('fs'); -const path = require('path'); -const prettier = require('prettier'); -const ts = require('typescript'); const { buildConfig, getBabelConfig, getBuildOptions, getTypeScriptCompilerOptions, } = require('./config'); +const babel = require('@babel/core'); +const {parseArgs} = require('@pkgjs/parseargs'); +const chalk = require('chalk'); +const translate = require('flow-api-translator'); +const {promises: fs} = require('fs'); +const glob = require('glob'); +const micromatch = require('micromatch'); +const path = require('path'); +const prettier = require('prettier'); +const ts = require('typescript'); const REPO_ROOT = path.resolve(__dirname, '../..'); const PACKAGES_DIR /*: string */ = path.join(REPO_ROOT, 'packages'); diff --git a/scripts/build/clean.js b/scripts/build/clean.js index 15296f06556..ca71451d73f 100644 --- a/scripts/build/clean.js +++ b/scripts/build/clean.js @@ -9,11 +9,11 @@ * @oncall react_native */ +const {BUILD_DIR, PACKAGES_DIR} = require('./build'); +const {buildConfig} = require('./config'); const {parseArgs} = require('@pkgjs/parseargs'); const fs = require('fs'); const path = require('path'); -const {BUILD_DIR, PACKAGES_DIR} = require('./build'); -const {buildConfig} = require('./config'); const config = { options: { diff --git a/scripts/circle-ci-artifacts-utils.js b/scripts/circle-ci-artifacts-utils.js index fb23b68df49..c2a9e755a4c 100644 --- a/scripts/circle-ci-artifacts-utils.js +++ b/scripts/circle-ci-artifacts-utils.js @@ -10,10 +10,9 @@ 'use strict'; -const {exec} = require('shelljs'); - -const util = require('util'); const asyncRequest = require('request'); +const {exec} = require('shelljs'); +const util = require('util'); const request = util.promisify(asyncRequest); let circleCIHeaders; diff --git a/scripts/circleci/pipeline_selection.js b/scripts/circleci/pipeline_selection.js index 2059c0f04ee..5804ce82755 100644 --- a/scripts/circleci/pipeline_selection.js +++ b/scripts/circleci/pipeline_selection.js @@ -12,9 +12,9 @@ * based on the files modified by the commit. */ +const {execSync} = require('child_process'); const fs = require('fs'); const yargs = require('yargs'); -const {execSync} = require('child_process'); /** * Check whether the filename is a JS/TS file and not in the script folder diff --git a/scripts/circleci/poll-maven.js b/scripts/circleci/poll-maven.js index a71ce0c38c1..0391222906c 100644 --- a/scripts/circleci/poll-maven.js +++ b/scripts/circleci/poll-maven.js @@ -7,8 +7,8 @@ * @format */ -const fetch = require('node-fetch'); const fs = require('fs'); +const fetch = require('node-fetch'); const baseMavenRepo = 'https://repo1.maven.org/maven2/com/facebook/react'; const artifacts = ['react-native-artifacts', 'react-android', 'hermes-android']; diff --git a/scripts/debugger-frontend/sync-and-build.js b/scripts/debugger-frontend/sync-and-build.js index 2752efbffa4..9c1866f285d 100644 --- a/scripts/debugger-frontend/sync-and-build.js +++ b/scripts/debugger-frontend/sync-and-build.js @@ -15,7 +15,7 @@ const ansiStyles = require('ansi-styles'); const chalk = require('chalk'); const {execSync, spawnSync} = require('child_process'); const {promises: fs} = require('fs'); -const {tmpdir, hostname, userInfo} = require('os'); +const {hostname, tmpdir, userInfo} = require('os'); const path = require('path'); // $FlowFixMe[untyped-import]: TODO type rimraf const rimraf = require('rimraf'); diff --git a/scripts/lint-java.js b/scripts/lint-java.js index 5277ea41913..105e4cc0680 100644 --- a/scripts/lint-java.js +++ b/scripts/lint-java.js @@ -9,11 +9,11 @@ 'use strict'; -const {exec} = require('shelljs'); -const https = require('https'); const fs = require('fs'); -const path = require('path'); +const https = require('https'); const os = require('os'); +const path = require('path'); +const {exec} = require('shelljs'); const yargs = require('yargs'); const googleJavaFormatUrl = diff --git a/scripts/monorepo/__tests__/bump-package-version-test.js b/scripts/monorepo/__tests__/bump-package-version-test.js index dd67ab2b6b5..1481e5ac408 100644 --- a/scripts/monorepo/__tests__/bump-package-version-test.js +++ b/scripts/monorepo/__tests__/bump-package-version-test.js @@ -7,10 +7,9 @@ * @format */ -const path = require('path'); -const {writeFileSync} = require('fs'); - const bumpPackageVersion = require('../bump-all-updated-packages/bump-package-version'); +const {writeFileSync} = require('fs'); +const path = require('path'); jest.mock('fs', () => ({ writeFileSync: jest.fn(), diff --git a/scripts/monorepo/__tests__/find-and-publish-all-bumped-packages-test.js b/scripts/monorepo/__tests__/find-and-publish-all-bumped-packages-test.js index 7ef3f9ca0de..f22b2b0e353 100644 --- a/scripts/monorepo/__tests__/find-and-publish-all-bumped-packages-test.js +++ b/scripts/monorepo/__tests__/find-and-publish-all-bumped-packages-test.js @@ -7,11 +7,10 @@ * @format */ -const {spawnSync} = require('child_process'); - const {PUBLISH_PACKAGES_TAG} = require('../constants'); -const forEachPackage = require('../for-each-package'); const findAndPublishAllBumpedPackages = require('../find-and-publish-all-bumped-packages'); +const forEachPackage = require('../for-each-package'); +const {spawnSync} = require('child_process'); jest.mock('child_process', () => ({spawnSync: jest.fn()})); jest.mock('../for-each-package', () => jest.fn()); diff --git a/scripts/monorepo/__tests__/for-each-package-test.js b/scripts/monorepo/__tests__/for-each-package-test.js index bcc688546a6..c3154d61940 100644 --- a/scripts/monorepo/__tests__/for-each-package-test.js +++ b/scripts/monorepo/__tests__/for-each-package-test.js @@ -7,10 +7,9 @@ * @format */ -const path = require('path'); -const {readdirSync, readFileSync} = require('fs'); - const forEachPackage = require('../for-each-package'); +const {readdirSync, readFileSync} = require('fs'); +const path = require('path'); jest.mock('fs', () => ({ readdirSync: jest.fn(), diff --git a/scripts/monorepo/__tests__/get-and-update-packages-test.js b/scripts/monorepo/__tests__/get-and-update-packages-test.js index 757cc2bbda8..9faf4f016ec 100644 --- a/scripts/monorepo/__tests__/get-and-update-packages-test.js +++ b/scripts/monorepo/__tests__/get-and-update-packages-test.js @@ -8,11 +8,11 @@ */ const getAndUpdatePackages = require('../get-and-update-packages'); -const path = require('path'); const { - mockPackages, expectedPackages, + mockPackages, } = require('./__fixtures__/get-and-update-packages-fixtures'); +const path = require('path'); const writeFileSyncMock = jest.fn(); const publishPackageMock = jest.fn(); diff --git a/scripts/monorepo/align-package-versions.js b/scripts/monorepo/align-package-versions.js index 8037f76ba79..d4ca5fc36b6 100644 --- a/scripts/monorepo/align-package-versions.js +++ b/scripts/monorepo/align-package-versions.js @@ -7,10 +7,9 @@ * @format */ -const {writeFileSync, readFileSync} = require('fs'); -const path = require('path'); - const forEachPackage = require('./for-each-package'); +const {readFileSync, writeFileSync} = require('fs'); +const path = require('path'); const ROOT_LOCATION = path.join(__dirname, '..', '..'); const TEMPLATE_LOCATION = path.join( diff --git a/scripts/monorepo/bump-all-updated-packages/index.js b/scripts/monorepo/bump-all-updated-packages/index.js index eef3f493de5..a04e043b5dd 100644 --- a/scripts/monorepo/bump-all-updated-packages/index.js +++ b/scripts/monorepo/bump-all-updated-packages/index.js @@ -7,6 +7,18 @@ * @format */ +const alignPackageVersions = require('../align-package-versions'); +const checkForGitChanges = require('../check-for-git-changes'); +const { + COMMIT_WITH_CUSTOM_MESSAGE_CHOICE, + COMMIT_WITH_GENERIC_MESSAGE_CHOICE, + GENERIC_COMMIT_MESSAGE, + NO_COMMIT_CHOICE, + PUBLISH_PACKAGES_TAG, +} = require('../constants'); +const forEachPackage = require('../for-each-package'); +const bumpPackageVersion = require('./bump-package-version'); +const detectPackageUnreleasedChanges = require('./bump-utils'); const chalk = require('chalk'); const {execSync} = require('child_process'); const inquirer = require('inquirer'); @@ -14,19 +26,6 @@ const path = require('path'); const {echo, exec, exit} = require('shelljs'); const yargs = require('yargs'); -const alignPackageVersions = require('../align-package-versions'); -const { - PUBLISH_PACKAGES_TAG, - GENERIC_COMMIT_MESSAGE, - NO_COMMIT_CHOICE, - COMMIT_WITH_GENERIC_MESSAGE_CHOICE, - COMMIT_WITH_CUSTOM_MESSAGE_CHOICE, -} = require('../constants'); -const forEachPackage = require('../for-each-package'); -const checkForGitChanges = require('../check-for-git-changes'); -const bumpPackageVersion = require('./bump-package-version'); -const detectPackageUnreleasedChanges = require('./bump-utils'); - const ROOT_LOCATION = path.join(__dirname, '..', '..', '..'); const { diff --git a/scripts/monorepo/find-and-publish-all-bumped-packages.js b/scripts/monorepo/find-and-publish-all-bumped-packages.js index 45f5f33e207..17ffb58ed7f 100644 --- a/scripts/monorepo/find-and-publish-all-bumped-packages.js +++ b/scripts/monorepo/find-and-publish-all-bumped-packages.js @@ -7,12 +7,11 @@ * @format */ -const path = require('path'); -const {spawnSync} = require('child_process'); - +const {publishPackage} = require('../npm-utils'); const {PUBLISH_PACKAGES_TAG} = require('./constants'); const forEachPackage = require('./for-each-package'); -const {publishPackage} = require('../npm-utils'); +const {spawnSync} = require('child_process'); +const path = require('path'); const ROOT_LOCATION = path.join(__dirname, '..', '..'); const NPM_CONFIG_OTP = process.env.NPM_CONFIG_OTP; diff --git a/scripts/monorepo/for-each-package.js b/scripts/monorepo/for-each-package.js index f3d865dfdac..49c4ec9107e 100644 --- a/scripts/monorepo/for-each-package.js +++ b/scripts/monorepo/for-each-package.js @@ -7,8 +7,8 @@ * @format */ -const path = require('path'); const {readdirSync, readFileSync} = require('fs'); +const path = require('path'); const ROOT_LOCATION = path.join(__dirname, '..', '..'); const PACKAGES_LOCATION = path.join(ROOT_LOCATION, 'packages'); diff --git a/scripts/monorepo/get-and-update-packages.js b/scripts/monorepo/get-and-update-packages.js index 5b59682d26c..62446e984b3 100644 --- a/scripts/monorepo/get-and-update-packages.js +++ b/scripts/monorepo/get-and-update-packages.js @@ -9,11 +9,11 @@ * @oncall react_native */ -const forEachPackage = require('./for-each-package'); const {publishPackage} = require('../npm-utils'); -const path = require('path'); -const {writeFileSync} = require('fs'); const {getPackageVersionStrByTag} = require('../npm-utils'); +const forEachPackage = require('./for-each-package'); +const {writeFileSync} = require('fs'); +const path = require('path'); /** * Get the latest version of each monorepo package and publishes a new package if there have been updates. diff --git a/scripts/npm-utils.js b/scripts/npm-utils.js index f7585a7553a..3f0bb34aa5a 100644 --- a/scripts/npm-utils.js +++ b/scripts/npm-utils.js @@ -9,13 +9,13 @@ 'use strict'; -const {exec} = require('shelljs'); -const {parseVersion} = require('./version-utils'); const { exitIfNotOnGit, getCurrentCommit, isTaggedLatest, } = require('./scm-utils'); +const {parseVersion} = require('./version-utils'); +const {exec} = require('shelljs'); // Get `next` version from npm and +1 on the minor for `main` version function getMainVersion() { diff --git a/scripts/prepare-package-for-release.js b/scripts/prepare-package-for-release.js index 2a61023caef..d90182495ce 100755 --- a/scripts/prepare-package-for-release.js +++ b/scripts/prepare-package-for-release.js @@ -9,6 +9,8 @@ 'use strict'; +const {failIfTagExists} = require('./release-utils'); +const {isReleaseBranch, parseVersion} = require('./version-utils'); /** * This script prepares a release package to be pushed to npm * It is triggered to run on CircleCI @@ -20,8 +22,6 @@ */ const {echo, exec, exit} = require('shelljs'); const yargs = require('yargs'); -const {isReleaseBranch, parseVersion} = require('./version-utils'); -const {failIfTagExists} = require('./release-utils'); const argv = yargs .option('r', { diff --git a/scripts/publish-npm.js b/scripts/publish-npm.js index c1e86164fe7..e8e710b2caf 100755 --- a/scripts/publish-npm.js +++ b/scripts/publish-npm.js @@ -9,16 +9,16 @@ 'use strict'; -const {echo, exit} = require('shelljs'); -const {publishPackage, getNpmInfo} = require('./npm-utils'); const getAndUpdatePackages = require('./monorepo/get-and-update-packages'); -const setReactNativeVersion = require('./set-rn-version'); -const removeNewArchFlags = require('./releases/remove-new-arch-flags'); +const {getNpmInfo, publishPackage} = require('./npm-utils'); const { generateAndroidArtifacts, publishAndroidArtifactsToMaven, } = require('./release-utils'); +const removeNewArchFlags = require('./releases/remove-new-arch-flags'); +const setReactNativeVersion = require('./set-rn-version'); const path = require('path'); +const {echo, exit} = require('shelljs'); const yargs = require('yargs'); /** diff --git a/scripts/release-utils.js b/scripts/release-utils.js index 720bec8a5f6..d31b5c81b19 100644 --- a/scripts/release-utils.js +++ b/scripts/release-utils.js @@ -9,10 +9,10 @@ 'use strict'; -const {exec, echo, exit, test, env, pushd, popd} = require('shelljs'); const { createHermesPrebuiltArtifactsTarball, } = require('../packages/react-native/scripts/hermes/hermes-utils'); +const {echo, env, exec, exit, popd, pushd, test} = require('shelljs'); function generateAndroidArtifacts(releaseVersion) { // -------- Generating Android Artifacts diff --git a/scripts/releases/__tests__/remove-new-arch-flags-test.js b/scripts/releases/__tests__/remove-new-arch-flags-test.js index 39b2d21342b..d5f36a431f9 100644 --- a/scripts/releases/__tests__/remove-new-arch-flags-test.js +++ b/scripts/releases/__tests__/remove-new-arch-flags-test.js @@ -8,17 +8,17 @@ * @oncall react-native */ -const fs = require('fs'); -const path = require('path'); const removeNewArchFlags = require('../remove-new-arch-flags'); const { - validReactNativePodsFile, - invalidReactNativePodsFile, - expectedReactNativePodsFile, - validGradlePropertiesFile, - invalidGradlePropertiesFile, expectedGradlePropertiesFile, + expectedReactNativePodsFile, + invalidGradlePropertiesFile, + invalidReactNativePodsFile, + validGradlePropertiesFile, + validReactNativePodsFile, } = require('./__fixtures__/remove-new-arch-flags-fixture'); +const fs = require('fs'); +const path = require('path'); describe('removeNewArchFlags', () => { beforeEach(() => { diff --git a/scripts/run-android-ci-instrumentation-tests.js b/scripts/run-android-ci-instrumentation-tests.js index d012866b307..e4fa8581e89 100644 --- a/scripts/run-android-ci-instrumentation-tests.js +++ b/scripts/run-android-ci-instrumentation-tests.js @@ -21,12 +21,12 @@ * --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1 */ -const {echo, exec, exit, ls} = require('shelljs'); - -const argv = require('yargs').argv; -const numberOfRetries = argv.retries || 1; const tryExecNTimes = require('./try-n-times'); const path = require('path'); +const {echo, exec, exit, ls} = require('shelljs'); +const argv = require('yargs').argv; + +const numberOfRetries = argv.retries || 1; // Flaky tests ignored on Circle CI. They still run internally at fb. const ignoredTests = [ diff --git a/scripts/run-ci-e2e-tests.js b/scripts/run-ci-e2e-tests.js index 4ec5db85037..7c28b4c6f3c 100644 --- a/scripts/run-ci-e2e-tests.js +++ b/scripts/run-ci-e2e-tests.js @@ -19,18 +19,17 @@ * --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1 */ -const {cd, cp, echo, exec, exit, mv} = require('shelljs'); -const {execFileSync, spawn} = require('child_process'); -const argv = require('yargs').argv; -const path = require('path'); - const forEachPackage = require('./monorepo/for-each-package'); const setupVerdaccio = require('./setup-verdaccio'); +const tryExecNTimes = require('./try-n-times'); +const {execFileSync, spawn} = require('child_process'); +const path = require('path'); +const {cd, cp, echo, exec, exit, mv} = require('shelljs'); +const argv = require('yargs').argv; const SCRIPTS = __dirname; const ROOT = path.normalize(path.join(__dirname, '..')); const REACT_NATIVE_PACKAGE_DIR = path.join(ROOT, 'packages/react-native'); -const tryExecNTimes = require('./try-n-times'); const REACT_NATIVE_TEMP_DIR = exec( 'mktemp -d /tmp/react-native-XXXXXXXX', diff --git a/scripts/scm-utils.js b/scripts/scm-utils.js index eab057bd5f4..8094a6584d8 100644 --- a/scripts/scm-utils.js +++ b/scripts/scm-utils.js @@ -9,10 +9,10 @@ 'use strict'; -const {cp, echo, exec, exit} = require('shelljs'); const fs = require('fs'); -const path = require('path'); const mkdirp = require('mkdirp'); +const path = require('path'); +const {cp, echo, exec, exit} = require('shelljs'); function isGitRepo() { try { diff --git a/scripts/set-rn-version.js b/scripts/set-rn-version.js index f445e08ae49..a9f8da60ba4 100755 --- a/scripts/set-rn-version.js +++ b/scripts/set-rn-version.js @@ -9,12 +9,12 @@ 'use strict'; +const {applyPackageVersions, getNpmInfo} = require('./npm-utils'); +const updateTemplatePackage = require('./update-template-package'); +const {parseVersion, validateBuildType} = require('./version-utils'); const fs = require('fs'); const {cat, echo, exit, sed} = require('shelljs'); const yargs = require('yargs'); -const {parseVersion, validateBuildType} = require('./version-utils'); -const updateTemplatePackage = require('./update-template-package'); -const {applyPackageVersions, getNpmInfo} = require('./npm-utils'); /** * This script updates relevant React Native files with supplied version: diff --git a/scripts/template/initialize.js b/scripts/template/initialize.js index 32f26dc3f8f..f24fc4b77e4 100644 --- a/scripts/template/initialize.js +++ b/scripts/template/initialize.js @@ -9,13 +9,12 @@ 'use strict'; -const yargs = require('yargs'); -const {execSync} = require('child_process'); -const path = require('path'); - +const {retry} = require('../circleci/retry'); const forEachPackage = require('../monorepo/for-each-package'); const setupVerdaccio = require('../setup-verdaccio'); -const {retry} = require('../circleci/retry'); +const {execSync} = require('child_process'); +const path = require('path'); +const yargs = require('yargs'); const {argv} = yargs .option('r', { diff --git a/scripts/test-e2e-local-clean.js b/scripts/test-e2e-local-clean.js index 30e94bf34d1..b86a8a43b23 100644 --- a/scripts/test-e2e-local-clean.js +++ b/scripts/test-e2e-local-clean.js @@ -28,9 +28,8 @@ * - an option to uninstall the apps (RNTester, RNTestProject) from emulators */ -const {exec, exit} = require('shelljs'); - const {isPackagerRunning} = require('./testing-utils'); +const {exec, exit} = require('shelljs'); console.info('\n** Starting the clean up process **\n'); diff --git a/scripts/testing-utils.js b/scripts/testing-utils.js index c2b18342ba9..8588a9bba16 100644 --- a/scripts/testing-utils.js +++ b/scripts/testing-utils.js @@ -9,23 +9,20 @@ 'use strict'; -const {exec, cp} = require('shelljs'); -const fs = require('fs'); -const os = require('os'); -const {spawn} = require('node:child_process'); -const path = require('path'); - -const circleCIArtifactsUtils = require('./circle-ci-artifacts-utils.js'); - -const { - generateAndroidArtifacts, - generateiOSArtifacts, -} = require('./release-utils'); - const { downloadHermesSourceTarball, expandHermesSourceTarball, } = require('../packages/react-native/scripts/hermes/hermes-utils.js'); +const circleCIArtifactsUtils = require('./circle-ci-artifacts-utils.js'); +const { + generateAndroidArtifacts, + generateiOSArtifacts, +} = require('./release-utils'); +const fs = require('fs'); +const {spawn} = require('node:child_process'); +const os = require('os'); +const path = require('path'); +const {cp, exec} = require('shelljs'); /* * Android related utils - leverages android tooling diff --git a/scripts/trigger-react-native-release.js b/scripts/trigger-react-native-release.js index 2986e95fca6..f5aaf0f2dcf 100644 --- a/scripts/trigger-react-native-release.js +++ b/scripts/trigger-react-native-release.js @@ -10,23 +10,22 @@ 'use strict'; +const detectPackageUnreleasedChanges = require('./monorepo/bump-all-updated-packages/bump-utils.js'); +const checkForGitChanges = require('./monorepo/check-for-git-changes'); +const forEachPackage = require('./monorepo/for-each-package'); +const {failIfTagExists} = require('./release-utils'); +const {exitIfNotOnGit, getBranchName} = require('./scm-utils'); +const {isReleaseBranch, parseVersion} = require('./version-utils'); +const chalk = require('chalk'); +const inquirer = require('inquirer'); +const path = require('path'); +const request = require('request'); /** * This script walks a releaser through bumping the version for a release * It will commit the appropriate tags to trigger the CircleCI jobs. */ -const {exit, echo} = require('shelljs'); -const chalk = require('chalk'); +const {echo, exit} = require('shelljs'); const yargs = require('yargs'); -const inquirer = require('inquirer'); -const request = require('request'); -const path = require('path'); -const {getBranchName, exitIfNotOnGit} = require('./scm-utils'); - -const {parseVersion, isReleaseBranch} = require('./version-utils'); -const {failIfTagExists} = require('./release-utils'); -const checkForGitChanges = require('./monorepo/check-for-git-changes'); -const forEachPackage = require('./monorepo/for-each-package'); -const detectPackageUnreleasedChanges = require('./monorepo/bump-all-updated-packages/bump-utils.js'); const ROOT_LOCATION = path.join(__dirname, '..'); diff --git a/scripts/update-template-package.js b/scripts/update-template-package.js index 9443707db56..b3203f4c7dd 100755 --- a/scripts/update-template-package.js +++ b/scripts/update-template-package.js @@ -9,9 +9,9 @@ 'use strict'; +const {applyPackageVersions} = require('./npm-utils'); const fs = require('fs'); const path = require('path'); -const {applyPackageVersions} = require('./npm-utils'); /** * Updates the react-native template package.json with diff --git a/tools/__tests__/no-dependencies-in-root-package-test.js b/tools/__tests__/no-dependencies-in-root-package-test.js index e46bd9f074e..12a1109e1f9 100644 --- a/tools/__tests__/no-dependencies-in-root-package-test.js +++ b/tools/__tests__/no-dependencies-in-root-package-test.js @@ -8,8 +8,8 @@ * @flow strict-local */ -import path from 'path'; import fs from 'fs'; +import path from 'path'; const CURRENT_DIR = __dirname; const PATH_TO_ROOT_PACKAGE_MANIFEST = path.join( diff --git a/tools/__tests__/no-dev-dependencies-in-react-native-package-test.js b/tools/__tests__/no-dev-dependencies-in-react-native-package-test.js index 66493e85ea2..024e5d43562 100644 --- a/tools/__tests__/no-dev-dependencies-in-react-native-package-test.js +++ b/tools/__tests__/no-dev-dependencies-in-react-native-package-test.js @@ -8,8 +8,8 @@ * @flow strict-local */ -import path from 'path'; import fs from 'fs'; +import path from 'path'; const CURRENT_DIR = __dirname; const PATH_TO_REACT_NATIVE_PACKAGE_MANIFEST = path.join( diff --git a/tools/__tests__/no-dev-dependencies-in-tester-package.js b/tools/__tests__/no-dev-dependencies-in-tester-package.js index e7c87723a45..709bc9236c0 100644 --- a/tools/__tests__/no-dev-dependencies-in-tester-package.js +++ b/tools/__tests__/no-dev-dependencies-in-tester-package.js @@ -8,8 +8,8 @@ * @flow strict-local */ -import path from 'path'; import fs from 'fs'; +import path from 'path'; const CURRENT_DIR = __dirname; const PATH_TO_TESTER_PACKAGE_MANIFEST = path.join(