Skip to content

Commit

Permalink
Apply sort-imports lint rule to all files
Browse files Browse the repository at this point in the history
Summary: Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51946975

fbshipit-source-id: e31c7ccf68f6a6aa4b9fdc154d0d7e4712935d6c
  • Loading branch information
motiz88 authored and facebook-github-bot committed Dec 8, 2023
1 parent e0b0c88 commit 4127714
Show file tree
Hide file tree
Showing 77 changed files with 157 additions and 153 deletions.
2 changes: 1 addition & 1 deletion packages/metro-cache/src/stores/HttpGetStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

import type {HttpOptions} from 'metro-cache';
import type HttpError from './HttpError';
import type NetworkError from './NetworkError';
import type {HttpOptions} from 'metro-cache';

const HttpStore = require('./HttpStore');
const {Logger} = require('metro-core');
Expand Down
5 changes: 2 additions & 3 deletions packages/metro-config/src/configTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@

'use strict';

import type {IntermediateStackFrame} from '../../metro/src/Server/symbolicate';
import type {HandleFunction, Server} from 'connect';
import type {CacheStore} from 'metro-cache';
import typeof MetroCache from 'metro-cache';
import type {CacheManagerFactory} from 'metro-file-map';
import type {CustomResolver} from 'metro-resolver';
import type {JsTransformerConfig} from 'metro-transform-worker';
import type {TransformResult} from 'metro/src/DeltaBundler';
import type MetroServer from 'metro/src/Server';

import type {
DeltaResult,
Module,
ReadOnlyGraph,
SerializerOptions,
} from 'metro/src/DeltaBundler/types.flow.js';
import type {Reporter} from 'metro/src/lib/reporting';
import type {IntermediateStackFrame} from '../../metro/src/Server/symbolicate';
import type MetroServer from 'metro/src/Server';

export type ExtraTransformOptions = {
+preloadedModules?: {[path: string]: true, ...} | false,
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import type {ConfigT} from '../configTypes.flow';

const {
DEFAULT_METRO_MINIFIER_PATH,
additionalExts,
assetExts,
assetResolutions,
additionalExts,
defaultCreateModuleIdFactory,
noopPerfLoggerFactory,
platforms,
sourceExts,
noopPerfLoggerFactory,
} = require('./defaults');
const exclusionList = require('./exclusionList');
const {FileStore} = require('metro-cache');
Expand Down
12 changes: 6 additions & 6 deletions packages/metro-file-map/src/Watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import type {
import type {WatcherOptions as WatcherBackendOptions} from './watchers/common';
import type {AbortSignal} from 'node-abort-controller';

import watchmanCrawl from './crawlers/watchman';
import nodeCrawl from './crawlers/node';
import WatchmanWatcher from './watchers/WatchmanWatcher';
import watchmanCrawl from './crawlers/watchman';
import {ADD_EVENT, CHANGE_EVENT} from './watchers/common';
import FSEventsWatcher from './watchers/FSEventsWatcher';
import NodeWatcher from './watchers/NodeWatcher';
import * as path from 'path';
import * as fs from 'fs';
import {ADD_EVENT, CHANGE_EVENT} from './watchers/common';
import WatchmanWatcher from './watchers/WatchmanWatcher';
import EventEmitter from 'events';
import {performance} from 'perf_hooks';
import * as fs from 'fs';
import nullthrows from 'nullthrows';
import * as path from 'path';
import {performance} from 'perf_hooks';

const debug = require('debug')('Metro:Watcher');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @oncall react_native
*/

import {AbortController} from 'node-abort-controller';
import TreeFS from '../../lib/TreeFS';
import {AbortController} from 'node-abort-controller';

jest.useRealTimers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* @oncall react_native
*/

import {AbortController} from 'node-abort-controller';
import TreeFS from '../../lib/TreeFS';
import {AbortController} from 'node-abort-controller';

const path = require('path');

Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/crawlers/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import type {
IgnoreMatcher,
} from '../../flow-types';

import hasNativeFindSupport from './hasNativeFindSupport';
import * as fastPath from '../../lib/fast_path';
import hasNativeFindSupport from './hasNativeFindSupport';
import {spawn} from 'child_process';
import * as fs from 'graceful-fs';
import {platform} from 'os';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import type {CrawlerOptions} from '../../../flow-types';

import TreeFS from '../../../lib/TreeFS';
import watchmanCrawl from '../index';
import EventEmitter from 'events';
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/flow-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

'use strict';

import type {PerfLoggerFactory, RootPerfLogger, PerfLogger} from 'metro-config';
import type {PerfLogger, PerfLoggerFactory, RootPerfLogger} from 'metro-config';
import type {AbortSignal} from 'node-abort-controller';

export type {PerfLoggerFactory, PerfLogger};
Expand Down
18 changes: 9 additions & 9 deletions packages/metro-file-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @oncall react_native
*/

import type {IJestWorker} from 'jest-worker';
import type {
BuildParameters,
BuildResult,
Expand All @@ -19,44 +18,45 @@ import type {
CanonicalPath,
ChangeEvent,
ChangeEventMetadata,
CrawlerOptions,
Console,
CrawlerOptions,
EventsQueue,
FileData,
FileMetaData,
FileSystem,
HType,
HasteMapData,
HasteMapItem,
HType,
MutableFileSystem,
Path,
PerfLoggerFactory,
PerfLogger,
PerfLoggerFactory,
RawMockMap,
ReadOnlyRawMockMap,
WorkerMetadata,
WatchmanClocks,
WorkerMetadata,
} from './flow-types';
import type {IJestWorker} from 'jest-worker';

import {DiskCacheManager} from './cache/DiskCacheManager';
import H from './constants';
import getMockName from './getMockName';
import checkWatchmanCapabilities from './lib/checkWatchmanCapabilities';
import {DuplicateError} from './lib/DuplicateError';
import * as fastPath from './lib/fast_path';
import MockMapImpl from './lib/MockMap';
import MutableHasteMap from './lib/MutableHasteMap';
import normalizePathSeparatorsToSystem from './lib/normalizePathSeparatorsToSystem';
import TreeFS from './lib/TreeFS';
import MutableHasteMap from './lib/MutableHasteMap';
import {Watcher} from './Watcher';
import {worker} from './worker';
import EventEmitter from 'events';
import invariant from 'invariant';
import {Worker} from 'jest-worker';
import * as path from 'path';
import {AbortController} from 'node-abort-controller';
import {performance} from 'perf_hooks';
import nullthrows from 'nullthrows';
import MockMapImpl from './lib/MockMap';
import * as path from 'path';
import {performance} from 'perf_hooks';

const debug = require('debug')('Metro:FileMap');

Expand Down
1 change: 1 addition & 0 deletions packages/metro-file-map/src/lib/MockMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import type {MockMap as IMockMap, Path, RawMockMap} from '../flow-types';

import {resolve} from './fast_path';

export default class MockMap implements IMockMap {
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/lib/MutableHasteMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import type {
Console,
DuplicatesIndex,
DuplicatesSet,
HTypeValue,
HasteMap,
HasteMapItem,
HasteMapItemMetaData,
HTypeValue,
Path,
RawHasteMap,
ReadOnlyRawHasteMap,
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/lib/__tests__/TreeFS-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* @oncall react_native
*/

import type TreeFS from '../TreeFS';
import type {FileData} from '../../flow-types';
import type TreeFS from '../TreeFS';

let mockPathModule;
jest.mock('path', () => mockPathModule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

import type {BuildParameters} from '../../flow-types';

import typeof PathModule from 'path';

import rootRelativeCacheKeys from '../rootRelativeCacheKeys';
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/watchers/FSEventsWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import type {Stats} from 'fs';
// $FlowFixMe[cannot-resolve-module] - Optional, Darwin only
import type {FSEvents} from 'fsevents';

import {isIncluded, typeFromStat} from './common';
// $FlowFixMe[untyped-import] - anymatch
import anymatch from 'anymatch';
import EventEmitter from 'events';
import {promises as fsPromises} from 'fs';
import * as path from 'path';
// $FlowFixMe[untyped-import] - walker
import walker from 'walker';
import {isIncluded, typeFromStat} from './common';

const debug = require('debug')('Metro:FSEventsWatcher');

Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/watchers/NodeWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

'use strict';

import type {WatcherOptions} from './common';
import type {ChangeEventMetadata} from '../flow-types';
import type {WatcherOptions} from './common';
import type {FSWatcher, Stats} from 'fs';

const common = require('./common');
Expand Down
4 changes: 2 additions & 2 deletions packages/metro-file-map/src/watchers/WatchmanWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
* @oncall react_native
*/

import type {WatcherOptions} from './common';
import type {ChangeEventMetadata} from '../flow-types';
import type {WatcherOptions} from './common';
import type {
Client,
WatchmanClockResponse,
WatchmanFileChange,
WatchmanQuery,
WatchmanSubscriptionEvent,
WatchmanSubscribeResponse,
WatchmanSubscriptionEvent,
WatchmanWatchResponse,
} from 'fb-watchman';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
*/

import type {
WatchmanSubscribeResponse,
WatchmanClockResponse,
WatchmanSubscribeResponse,
WatchmanWatchResponse,
} from 'fb-watchman';

import WatchmanWatcher from '../WatchmanWatcher';
import EventEmitter from 'events';

Expand Down
10 changes: 5 additions & 5 deletions packages/metro-file-map/src/watchers/__tests__/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
* @oncall react_native
*/

import type {ChangeEventMetadata} from '../../flow-types';
import type {WatcherOptions} from '../common';

import NodeWatcher from '../NodeWatcher';
import FSEventsWatcher from '../FSEventsWatcher';
import NodeWatcher from '../NodeWatcher';
import WatchmanWatcher from '../WatchmanWatcher';
import type {ChangeEventMetadata} from '../../flow-types';
import {promises as fsPromises} from 'fs';
import {execSync} from 'child_process';
import {join} from 'path';
import os from 'os';
import {promises as fsPromises} from 'fs';
import invariant from 'invariant';
import os from 'os';
import {join} from 'path';

jest.useRealTimers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* @oncall react_native
*/

import type {EventHelpers} from './helpers';
import type {WatcherOptions} from '../common';
import type {EventHelpers} from './helpers';

import FSEventsWatcher from '../FSEventsWatcher';
import {createTempWatchRoot, startWatching, WATCHERS} from './helpers';
import os from 'os';
import {WATCHERS, createTempWatchRoot, startWatching} from './helpers';
import {promises as fsPromises} from 'fs';
import os from 'os';
import {join} from 'path';
const {mkdir, writeFile, rm, symlink, unlink} = fsPromises;

Expand Down
2 changes: 1 addition & 1 deletion packages/metro-file-map/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const H = require('./constants');
const dependencyExtractor = require('./lib/dependencyExtractor');
const excludedExtensions = require('./workerExclusionList');
const {createHash} = require('crypto');
const fs = require('graceful-fs');
const {promises: fsPromises} = require('fs');
const fs = require('graceful-fs');
const path = require('path');

const PACKAGE_JSON = path.sep + 'package.json';
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-resolver/src/PackageExportsResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import type {
ResolutionContext,
} from './types';

import path from 'path';
import InvalidPackageConfigurationError from './errors/InvalidPackageConfigurationError';
import PackagePathNotExportedError from './errors/PackagePathNotExportedError';
import resolveAsset from './resolveAsset';
import isAssetFile from './utils/isAssetFile';
import toPosixPath from './utils/toPosixPath';
import path from 'path';

/**
* Resolve a package subpath based on the entry points defined in the package's
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-resolver/src/PackageResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import type {PackageInfo, PackageJson, ResolutionContext} from './types';

import path from 'path';
import toPosixPath from './utils/toPosixPath';
import path from 'path';

/**
* Resolve the main entry point subpath for a package.
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-resolver/src/__tests__/assets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

'use strict';

import path from 'path';
import Resolver from '../index';
import {createResolutionContext} from './utils';
import path from 'path';

describe('asset resolutions', () => {
const baseContext = {
Expand Down
3 changes: 2 additions & 1 deletion packages/metro-resolver/src/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import type {ResolutionContext} from '../index';

import {createResolutionContext} from './utils';

const FailedToResolvePathError = require('../errors/FailedToResolvePathError');
const Resolver = require('../index');
import {createResolutionContext} from './utils';

const fileMap = {
'/root/project/foo.js': '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* @oncall react_native
*/

import path from 'path';
import Resolver from '../index';
import {createPackageAccessors, createResolutionContext} from './utils';
import path from 'path';

// Tests validating Package Exports resolution behaviour. See RFC0534:
// https://github.com/react-native-community/discussions-and-proposals/blob/master/proposals/0534-metro-package-exports-support.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import type {ResolutionContext} from '../index';

import Resolver from '../index';
import FailedToResolvePathError from '../errors/FailedToResolvePathError';
import Resolver from '../index';
import {createResolutionContext} from './utils';

const fileMap = {
Expand Down
Loading

0 comments on commit 4127714

Please sign in to comment.