Skip to content

Commit

Permalink
Enable lint/sort-imports everywhere (facebook#41334)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#41334

TSIA.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51025812

fbshipit-source-id: 05952a518441b9befc1c84686e34a808b8001cc5
  • Loading branch information
motiz88 authored and facebook-github-bot committed Nov 6, 2023
1 parent e538a47 commit 0593357
Show file tree
Hide file tree
Showing 408 changed files with 1,346 additions and 1,406 deletions.
2 changes: 2 additions & 0 deletions jest/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

'use strict';

/* eslint-disable lint/sort-imports */

const metroBabelRegister = require('metro-babel-register');
const nullthrows = require('nullthrows');
const createCacheKeyFunction =
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-codegen/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions packages/community-cli-plugin/src/commands/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/commands/bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/community-cli-plugin/src/commands/start/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
19 changes: 9 additions & 10 deletions packages/community-cli-plugin/src/commands/start/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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[],
Expand Down
6 changes: 3 additions & 3 deletions packages/community-cli-plugin/src/utils/loadMetroConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
10 changes: 5 additions & 5 deletions packages/dev-middleware/src/createDevMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @oncall react_native
*/

import type {EventReporter} from '../types/EventReporter';
import type {
DebuggerRequest,
ErrorResponse,
Expand All @@ -22,10 +23,9 @@ import type {

import DeviceEventReporter from './DeviceEventReporter';
import * as fs from 'fs';
import * as path from 'path';
import fetch from 'node-fetch';
import * as path from 'path';
import WS from 'ws';
import type {EventReporter} from '../types/EventReporter';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

import type {EventReporter} from '../types/EventReporter';

import TTLCache from '@isaacs/ttlcache';

type PendingCommand = {
Expand Down
6 changes: 3 additions & 3 deletions packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, ?LaunchedBrowser>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-specs/react-native-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-plugin-specs/with-babel-register/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* @oncall react_native
*/

const diskCache = require('./disk-cache');
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 {DEFAULT_EXTENSIONS, OptionManager} = require('@babel/core');
const fs = require('fs');
const diskCache = require('./disk-cache');
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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 0593357

Please sign in to comment.