diff --git a/lib/utils/config.ts b/lib/utils/config.ts index 4be50b02..43a9dcf5 100644 --- a/lib/utils/config.ts +++ b/lib/utils/config.ts @@ -59,9 +59,10 @@ export function generateBaseConfig( appUpdatePollInterval: options.appUpdatePollInterval || 10, }; - const promise = resin.models.os.getConfig(application.app_name, options) as Promise< - ImgConfig & { apiKey?: string; } - >; + const promise = resin.models.os.getConfig( + application.app_name, + options, + ) as Promise; return promise.tap(config => { // os.getConfig always returns a config for an app delete config.apiKey; diff --git a/lib/utils/patterns.ts b/lib/utils/patterns.ts index 2eaca3ef..41c1e51d 100644 --- a/lib/utils/patterns.ts +++ b/lib/utils/patterns.ts @@ -99,7 +99,7 @@ export function askLoginType() { export function selectDeviceType() { return resin.models.config.getDeviceTypes().then(deviceTypes => { - deviceTypes = _.sortBy(deviceTypes, 'name') + deviceTypes = _.sortBy(deviceTypes, 'name'); return form.ask({ message: 'Device Type', type: 'list', diff --git a/lib/utils/promote.ts b/lib/utils/promote.ts index 7306b40f..c6d207dc 100644 --- a/lib/utils/promote.ts +++ b/lib/utils/promote.ts @@ -173,8 +173,10 @@ async function getOrSelectLocalDevice(deviceIp?: string): Promise { return ip; } -async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK, - options: ResinSdk.PineOptionsFor) { +async function getApplicationsWithOptionalUsers( + sdk: ResinSdk.ResinSDK, + options: ResinSdk.PineOptionsFor, +) { const _ = await import('lodash'); let applications = await sdk.models.application.getAll(options); @@ -182,7 +184,7 @@ async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK, // user has access to a collab app with the same name as a personal app. if (applications.length !== _.uniqBy(applications, 'app_name').length) { options = _.merge(_.cloneDeep(options), { - $expand: { user: { $select: ['username'] } } + $expand: { user: { $select: ['username'] } }, }); applications = await sdk.models.application.getAll(options); } @@ -190,7 +192,6 @@ async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK, return applications; } - async function selectAppFromList(applications: ResinSdk.Application[]) { const _ = await import('lodash'); const { selectFromList } = await import('../utils/patterns'); @@ -199,10 +200,13 @@ async function selectAppFromList(applications: ResinSdk.Application[]) { // user has access to a collab app with the same name as a personal app. We // present a list to the user which shows the fully qualified application // name (user/appname) and allows them to select. - const hasSameNameApps = applications.length !== _.uniqBy(applications, 'app_name').length + const hasSameNameApps = + applications.length !== _.uniqBy(applications, 'app_name').length; return selectFromList( - hasSameNameApps ? 'Found multiple applications with that name; please select the one to use' : 'Select application', + hasSameNameApps + ? 'Found multiple applications with that name; please select the one to use' + : 'Select application', _.map(applications, app => { let name = app.app_name; if (hasSameNameApps) { @@ -288,7 +292,8 @@ async function getOrSelectApplication( default: true, }); if (shouldCreateApp) { - return createApplication(sdk, deviceType, options.$filter.app_name as string); + return createApplication(sdk, deviceType, options.$filter + .app_name as string); } process.exit(1); } @@ -300,7 +305,7 @@ async function getOrSelectApplication( ); if (validApplications.length === 0) { - throw new Error('No application found with a matching device type') + throw new Error('No application found with a matching device type'); } if (validApplications.length === 1) {