Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
[xdl] Removed unused ts-ignores (#1121)
Browse files Browse the repository at this point in the history
* Removed unused ts-ignore

* Remove unused

* Update .eslintrc.js

* Added new sort import rule

* reorder imports
  • Loading branch information
EvanBacon authored Nov 5, 2019
1 parent feb47b2 commit cc9e1d8
Show file tree
Hide file tree
Showing 48 changed files with 153 additions and 184 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = {
},
rules: {
'no-constant-condition': ['warn', { checkLoops: false }],
'sort-imports': [
'warn',
{
ignoreDeclarationSort: true,
},
],
},
settings: {
react: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Credentials, IosCodeSigning } from '@expo/xdl';

import prompt from './prompt';
import revoke from './revoke';
import { generate, determineMissingCredentials } from './generate';
import { determineMissingCredentials, generate } from './generate';
import { PLATFORMS } from '../../constants';
import log from '../../../../log';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from 'crypto';
import { Encoder as Base32Encoder } from 'base32.js';
import crypto from 'crypto';

export default function generateBundleIdentifier(teamId) {
return `dev.expo.client.${base32(sha(teamId))}`;
Expand Down
22 changes: 11 additions & 11 deletions packages/expo-cli/src/commands/client/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import _ from 'lodash';
import fs from 'fs-extra';
import * as ConfigUtils from '@expo/config';
import { Android, Credentials, Simulator, UserManager } from '@expo/xdl';
import chalk from 'chalk';
import CliTable from 'cli-table';
import fs from 'fs-extra';
import _ from 'lodash';
import ora from 'ora';
import path from 'path';
import CliTable from 'cli-table';
import * as ConfigUtils from '@expo/config';
import { Android, Simulator, UserManager, Credentials } from '@expo/xdl';

import CommandError from '../../CommandError';
import log from '../../log';
import prompt from '../../prompt';
import urlOpts from '../../urlOpts';
import * as appleApi from '../build/ios/appleApi';
import { PLATFORMS } from '../build/constants';
import * as appleApi from '../build/ios/appleApi';
import { runAction, travelingFastlane } from '../build/ios/appleApi/fastlane';
import { createClientBuildRequest, getExperienceName, isAllowedToBuild } from './clientBuildApi';
import generateBundleIdentifier from './generateBundleIdentifier';
import selectAdhocProvisioningProfile from './selectAdhocProvisioningProfile';
import selectDistributionCert from './selectDistributionCert';
import selectPushKey from './selectPushKey';
import selectAdhocProvisioningProfile from './selectAdhocProvisioningProfile';
import generateBundleIdentifier from './generateBundleIdentifier';
import { createClientBuildRequest, getExperienceName, isAllowedToBuild } from './clientBuildApi';
import log from '../../log';
import prompt from '../../prompt';
import { Updater, clearTags } from './tagger';

const { IOS } = PLATFORMS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ora from 'ora';

import { runAction, travelingFastlane } from '../build/ios/appleApi/fastlane';
import { tagForUpdate } from './tagger';
import log from '../../log';

export default async function selectAdhocProvisioningProfile(
context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Credentials } from '@expo/xdl';
import open from 'open';
import ora from 'ora';
import { Credentials } from '@expo/xdl';

import log from '../../log';
import prompt from '../../prompt';
import * as appleApi from '../build/ios/appleApi';
import * as credentials from '../build/ios/credentials';
import promptForCredentials from '../build/ios/credentials/prompt/promptForCredentials';
import log from '../../log';
import prompt from '../../prompt';
import { tagForUpdate } from './tagger';

import { choosePreferredCreds } from './selectUtils';
import { tagForUpdate } from './tagger';

export default async function selectDistributionCert(context, options = {}) {
const certificates = context.username ? await chooseUnrevokedDistributionCert(context) : [];
Expand Down
9 changes: 4 additions & 5 deletions packages/expo-cli/src/commands/client/selectPushKey.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Credentials } from '@expo/xdl';
import open from 'open';
import ora from 'ora';
import { Credentials } from '@expo/xdl';

import log from '../../log';
import prompt from '../../prompt';
import * as appleApi from '../build/ios/appleApi';
import * as credentials from '../build/ios/credentials';
import promptForCredentials from '../build/ios/credentials/prompt/promptForCredentials';
import log from '../../log';
import prompt from '../../prompt';
import { tagForUpdate } from './tagger';

import { choosePreferredCreds } from './selectUtils';
import { tagForUpdate } from './tagger';

export default async function selectPushKey(context, options = {}) {
const pushKeys = context.username ? await chooseUnrevokedPushKey(context) : [];
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/src/commands/eject/Eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import semver from 'semver';
import pacote from 'pacote';
import temporary from 'tempy';
import JsonFile from '@expo/json-file';
import { Exp, ProjectUtils, Detach, Versions } from '@expo/xdl';
import { Detach, Exp, ProjectUtils, Versions } from '@expo/xdl';
import * as ConfigUtils from '@expo/config';
import * as PackageManager from '../../PackageManager';
import { validateGitStatusAsync } from '../utils/ProjectUtils';
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/src/commands/fetch/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
fetchAndroidKeystoreAsync,
fetchAndroidHashesAsync,
fetchAndroidKeystoreAsync,
fetchAndroidUploadCertAsync,
} from './android';
import fetchIosCerts from './ios';
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/src/commands/publish-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @flow
*/

import { Api, Project, ProjectUtils, FormData, UserManager } from '@expo/xdl';
import { Api, FormData, Project, ProjectUtils, UserManager } from '@expo/xdl';
import * as table from '../commands/utils/cli-table';

const HORIZ_CELL_WIDTH_SMALL = 15;
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/src/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import path from 'path';
import * as ConfigUtils from '@expo/config';
import { DevToolsServer } from '@expo/dev-tools';
import JsonFile from '@expo/json-file';
import { ProjectUtils, Web, Project, UserSettings, UrlUtils, Versions } from '@expo/xdl';
import { Project, ProjectUtils, UrlUtils, UserSettings, Versions, Web } from '@expo/xdl';
import chalk from 'chalk';
import openBrowser from 'react-dev-utils/openBrowser';
import intersection from 'lodash/intersection';
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-cli/src/commands/upload/BaseUploader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

import fs from 'fs-extra';
import { StandaloneBuild, ProjectUtils } from '@expo/xdl';
import { ProjectUtils, StandaloneBuild } from '@expo/xdl';
import chalk from 'chalk';

import { downloadFile } from './utils';
Expand Down
3 changes: 2 additions & 1 deletion packages/xdl/src/Analytics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os from 'os';
import Segment from 'analytics-node';
import os from 'os';

import ip from './ip';

let _segmentNodeInstance: Segment | undefined;
Expand Down
26 changes: 13 additions & 13 deletions packages/xdl/src/Android.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import _ from 'lodash';
import fs from 'fs-extra';
import * as ConfigUtils from '@expo/config';
import spawnAsync from '@expo/spawn-async';
import chalk from 'chalk';
import fs from 'fs-extra';
import _ from 'lodash';
import path from 'path';
import semver from 'semver';
import chalk from 'chalk';
import * as ConfigUtils from '@expo/config';

import * as Analytics from './Analytics';
import * as Binaries from './Binaries';
import Api from './Api';
import * as Binaries from './Binaries';
import Logger from './Logger';
import NotificationCode from './NotificationCode';
import * as ProjectUtils from './project/ProjectUtils';
import * as ProjectSettings from './ProjectSettings';
import UserSettings from './UserSettings';
import { getImageDimensionsAsync } from './tools/ImageUtils';
import * as UrlUtils from './UrlUtils';
import UserSettings from './UserSettings';
import * as Versions from './Versions';
import { getImageDimensionsAsync } from './tools/ImageUtils';
// @ts-ignore
import { getUrlAsync as getWebpackUrlAsync } from './Webpack';

let _lastUrl: string | null = null;
const BEGINNING_OF_ADB_ERROR_MESSAGE = 'error: ';
const CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';
Expand Down Expand Up @@ -267,11 +267,11 @@ export async function openWebProjectAsync(
try {
await startAdbReverseAsync(projectRoot);

const projectUrl = await getWebpackUrlAsync(projectRoot);
const projectUrl = await getWebpackUrlAsync(projectRoot);
if (projectUrl === null) {
return {
success: false,
error: `The web project has not been started yet`
return {
success: false,
error: `The web project has not been started yet`,
};
}
await openUrlAsync(projectUrl, true);
Expand Down Expand Up @@ -386,7 +386,7 @@ export async function checkSplashScreenImages(projectDir: string): Promise<void>
}

const splashScreenMode =
_.get(exp, 'android.splash.resizeMode') || _.get(exp, 'splash.resizeMode', 'contain');
_.get(exp, 'android.splash.resizeMode') || _.get(exp, 'splash.resizeMode', 'contain');

// only mode `native` is handled by this check
if (splashScreenMode === 'contain' || splashScreenMode === 'cover') {
Expand Down
9 changes: 4 additions & 5 deletions packages/xdl/src/Api.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import path from 'path';

import { JSONObject } from '@expo/json-file';
import axios, { AxiosRequestConfig, Canceler } from 'axios';
import concat from 'concat-stream';
import ExtendableError from 'es6-error';
import FormData from 'form-data';
import fs from 'fs-extra';
import { JSONObject } from '@expo/json-file';
import isString from 'lodash/isString';
import path from 'path';

import { Cacher } from './tools/FsCache';
import Config from './Config';
import * as Extract from './Extract';
import * as Session from './Session';
import { Cacher } from './tools/FsCache';
import UserManager from './User';
import UserSettings from './UserSettings';
import XDLError from './XDLError';
Expand Down Expand Up @@ -171,7 +170,7 @@ async function _downloadAsync(
response.data
.on('data', (chunk: Buffer) => {
downloadProgress += chunk.length;
const roundedProgress = Math.floor((downloadProgress / totalDownloadSize) * 100);
const roundedProgress = Math.floor(downloadProgress / totalDownloadSize * 100);
if (currentProgress !== roundedProgress) {
currentProgress = roundedProgress;
clearTimeout(warningTimer);
Expand Down
8 changes: 4 additions & 4 deletions packages/xdl/src/ApiV2.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import merge from 'lodash/merge';
import ExtendableError from 'es6-error';
import QueryString from 'querystring';
import { JSONObject, JSONValue } from '@expo/json-file';
import axios, { AxiosRequestConfig } from 'axios';
import ExtendableError from 'es6-error';
import idx from 'idx';
import { JSONObject, JSONValue } from '@expo/json-file';
import merge from 'lodash/merge';
import QueryString from 'querystring';

import Config from './Config';

Expand Down
12 changes: 6 additions & 6 deletions packages/xdl/src/AssetUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs from 'fs-extra';
import path from 'path';
import crypto from 'crypto';
import chalk from 'chalk';
import glob from 'glob';
import { readConfigJsonAsync } from '@expo/config';
import { sharpAsync } from '@expo/image-utils';
import JsonFile from '@expo/json-file';
import { readConfigJsonAsync } from '@expo/config';
import chalk from 'chalk';
import crypto from 'crypto';
import fs from 'fs-extra';
import glob from 'glob';
import path from 'path';
import temporary from 'tempy';

import logger from './Logger';
Expand Down
3 changes: 0 additions & 3 deletions packages/xdl/src/Binaries.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fs from 'fs-extra';
import hasbin from 'hasbin';
import spawnAsync from '@expo/spawn-async';
import path from 'path';

import Config from './Config';
import Logger from './Logger';
import UserSettings from './UserSettings';
import XDLError from './XDLError';

Expand Down
3 changes: 1 addition & 2 deletions packages/xdl/src/Env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os from 'os';

import getenv from 'getenv';
import os from 'os';

export function home(): string {
return os.homedir();
Expand Down
1 change: 0 additions & 1 deletion packages/xdl/src/Exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import pacote, { PackageSpec } from 'pacote';
import tar from 'tar';

import Api from './Api';
import * as Binaries from './Binaries';
import Logger from './Logger';
import NotificationCode from './NotificationCode';
import * as ThirdParty from './ThirdParty';
Expand Down
4 changes: 2 additions & 2 deletions packages/xdl/src/Extract.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import spawnAsync from '@expo/spawn-async';
import fs from 'fs-extra';
import tar from 'tar';
import path from 'path';
import spawnAsync from '@expo/spawn-async';
import tar from 'tar';
import uuid from 'uuid';

import * as Binaries from './Binaries';
Expand Down
3 changes: 1 addition & 2 deletions packages/xdl/src/FileSystem.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { execSync } from 'child_process';

import * as osascript from '@expo/osascript';
import spawnAsync from '@expo/spawn-async';
import { execSync } from 'child_process';

import XDLError from './XDLError';

Expand Down
2 changes: 0 additions & 2 deletions packages/xdl/src/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ import * as Watchman from './Watchman';
import * as Webpack from './Webpack';
import XDLError from './XDLError';

// @ts-ignore Doctor not yet converted to TypeScript
import * as Doctor from './project/Doctor';
// @ts-ignore IosPlist not yet converted to TypeScript
import * as IosPlist from './detach/IosPlist';
// @ts-ignore IosWorkspace not yet converted to TypeScript
import * as IosWorkspace from './detach/IosWorkspace';
Expand Down
2 changes: 1 addition & 1 deletion packages/xdl/src/ProjectSettings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import defaults from 'lodash/defaults';
import JsonFile from '@expo/json-file';
import fs from 'fs-extra';
import defaults from 'lodash/defaults';
import path from 'path';

export type ProjectSettings = {
Expand Down
1 change: 1 addition & 0 deletions packages/xdl/src/Sentry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Raven from 'raven';

import Config from './Config';

const SENTRY_DSN =
Expand Down
16 changes: 7 additions & 9 deletions packages/xdl/src/Simulator.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import os from 'os';
import path from 'path';

import * as ConfigUtils from '@expo/config';
import delayAsync from 'delay-async';
import glob from 'glob-promise';
import * as osascript from '@expo/osascript';
import semver from 'semver';
import spawnAsync from '@expo/spawn-async';
import delayAsync from 'delay-async';
import fs from 'fs-extra';
import glob from 'glob-promise';
import os from 'os';
import path from 'path';
import semver from 'semver';

import * as Analytics from './Analytics';
import Api from './Api';
import Logger from './Logger';
import NotificationCode from './NotificationCode';
import * as UrlUtils from './UrlUtils';
import UserSettings from './UserSettings';
import * as Versions from './Versions';
import XDLError from './XDLError';
import * as UrlUtils from './UrlUtils';
// @ts-ignore
import { getUrlAsync as getWebpackUrlAsync } from './Webpack';
import XDLError from './XDLError';

let _lastUrl: string | null = null;

Expand Down
2 changes: 1 addition & 1 deletion packages/xdl/src/StandaloneBuild.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Platform } from '@expo/config';
import _ from 'lodash';

import ApiV2Client from './ApiV2';
import UserManager from './User';
import { Platform } from '@expo/config';

export async function getStandaloneBuilds({
id,
Expand Down
Loading

0 comments on commit cc9e1d8

Please sign in to comment.