From a4c13aa2e925934db26b175876d492995dd4a519 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Mon, 19 Sep 2022 16:08:16 +0100 Subject: [PATCH 1/2] Update to typescript 4.8.2 Change-type: patch --- package-lock.json | 6 +++--- package.json | 2 +- src/api-binder/index.ts | 2 +- src/compose/app.ts | 2 +- src/compose/images.ts | 6 +++--- src/compose/network-manager.ts | 2 +- src/compose/service-manager.ts | 10 +++++----- src/compose/volume-manager.ts | 2 +- src/config/backends/odmdata.ts | 2 +- src/config/index.ts | 8 ++++---- src/device-api/v2.ts | 8 ++++---- src/device-config.ts | 8 ++++---- src/device-state.ts | 10 +++++----- src/device-state/preload.ts | 4 ++-- src/device-state/target-state.ts | 2 +- src/host-config.ts | 6 +++--- src/lib/api-helper.ts | 4 ++-- src/lib/contracts.ts | 2 +- src/lib/json.ts | 2 +- src/lib/legacy.ts | 4 ++-- src/lib/lockfile.ts | 2 +- src/lib/os-release.ts | 2 +- src/lib/update-lock.ts | 2 +- src/local-mode.ts | 6 +++--- src/migrations/20171129064057_multicontainer.js | 2 +- .../20181907164000-endpoint-specific-logschannel.js | 2 +- src/migrations/M00002.js | 2 +- src/network.ts | 2 +- src/proxyvisor.js | 6 +++--- src/supervisor-api.ts | 2 +- sync/init.ts | 2 +- test/legacy/05-device-state.spec.ts | 2 +- test/legacy/21-supervisor-api.spec.ts | 4 ++-- test/legacy/22-local-mode.spec.ts | 4 ++-- test/legacy/27-extlinux-config.spec.ts | 2 +- test/legacy/28-db-format.spec.ts | 2 +- test/legacy/37-odmdata-config.spec.ts | 4 ++-- test/legacy/41-device-api-v1.spec.ts | 2 +- test/legacy/42-device-api-v2.spec.ts | 2 +- test/legacy/src/compose/application-manager.spec.ts | 2 +- test/lib/mocked-dockerode.ts | 2 +- test/lib/mockerode.ts | 4 +++- test/lib/prepare.ts | 6 +++--- webpack.config.js | 2 +- 44 files changed, 81 insertions(+), 79 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3dc0a805..094b4ebc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11848,9 +11848,9 @@ } }, "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", + "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 7a8a6b31..4d894302 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "ts-node": "^8.10.2", "tsconfig-paths": "^4.1.0", "typed-error": "^3.2.1", - "typescript": "^4.2.4", + "typescript": "^4.8.3", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", "winston": "^3.3.3", diff --git a/src/api-binder/index.ts b/src/api-binder/index.ts index c217f1f5..d6e57ef6 100644 --- a/src/api-binder/index.ts +++ b/src/api-binder/index.ts @@ -535,7 +535,7 @@ async function reportInitialName( device_name: name, }, }); - } catch (err) { + } catch (err: any) { log.error('Unable to report initial device name to API'); logger.logSystemMessage( 'Unable to report initial device name to API', diff --git a/src/compose/app.ts b/src/compose/app.ts index 68e44729..07709bb9 100644 --- a/src/compose/app.ts +++ b/src/compose/app.ts @@ -809,7 +809,7 @@ export class App { let imageInfo: ImageInspectInfo | undefined; try { imageInfo = await imageManager.inspectByName(svc.image); - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { throw e; } diff --git a/src/compose/images.ts b/src/compose/images.ts index e35642a5..a4aa774b 100644 --- a/src/compose/images.ts +++ b/src/compose/images.ts @@ -239,7 +239,7 @@ export async function triggerFetch( await markAsSupervised({ ...image, dockerImageId: img.Id }); success = true; - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { if (!(e instanceof ImageDownloadBackoffError)) { addImageFailure(image.name); @@ -618,7 +618,7 @@ export async function cleanup() { try { await docker.getImage(image).remove({ force: true }); delete imageCleanupFailures[image]; - } catch (e) { + } catch (e: any) { logger.logSystemMessage( `Error cleaning up ${image}: ${e.message} - will ignore for 1 hour`, { error: e }, @@ -730,7 +730,7 @@ async function removeImageIfNotNeeded(image: Image): Promise { // Mark the image as removed removed = true; - } catch (e) { + } catch (e: any) { if (NotFoundError(e)) { removed = false; } else { diff --git a/src/compose/network-manager.ts b/src/compose/network-manager.ts index a880c3a1..6bbc148a 100644 --- a/src/compose/network-manager.ts +++ b/src/compose/network-manager.ts @@ -45,7 +45,7 @@ export async function create(network: Network) { // We have a network with the same config and name // already created, we can skip this - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { logger.logSystemEvent(logTypes.createNetworkError, { network: { name: network.name, appUuid: network.appUuid }, diff --git a/src/compose/service-manager.ts b/src/compose/service-manager.ts index 6228806f..4a1eea52 100644 --- a/src/compose/service-manager.ts +++ b/src/compose/service-manager.ts @@ -74,7 +74,7 @@ export const getAll = async ( service.status = vState.status; } return service; - } catch (e) { + } catch (e: any) { if (NotFoundError(e)) { return null; } @@ -210,7 +210,7 @@ export async function remove(service: Service) { try { await docker.getContainer(existingService.containerId).remove({ v: true }); - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { logger.logSystemEvent(LogTypes.removeDeadServiceError, { service, @@ -231,7 +231,7 @@ async function create(service: Service) { ); } return docker.getContainer(existing.containerId); - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { logger.logSystemEvent(LogTypes.installServiceError, { service, @@ -387,7 +387,7 @@ export function listenToEvents() { let service: Service | null = null; try { service = await getByDockerContainerId(data.id); - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { throw e; } @@ -418,7 +418,7 @@ export function listenToEvents() { await logMonitor.detach(data.id); } } - } catch (e) { + } catch (e: any) { log.error('Error on docker event:', e, e.stack); } } diff --git a/src/compose/volume-manager.ts b/src/compose/volume-manager.ts index bb128f72..34167d39 100644 --- a/src/compose/volume-manager.ts +++ b/src/compose/volume-manager.ts @@ -58,7 +58,7 @@ export async function create(volume: Volume): Promise { if (!volume.isEqualConfig(existing)) { throw new ResourceRecreationAttemptError('volume', volume.name); } - } catch (e) { + } catch (e: any) { if (!NotFoundError(e)) { logger.logSystemEvent(LogTypes.createVolumeError, { volume: { name: volume.name }, diff --git a/src/config/backends/odmdata.ts b/src/config/backends/odmdata.ts index e7708501..cd08a7d5 100644 --- a/src/config/backends/odmdata.ts +++ b/src/config/backends/odmdata.ts @@ -186,7 +186,7 @@ export class Odmdata extends ConfigBackend { ): Promise { try { return await fs.open(file, flags); - } catch (e) { + } catch (e: any) { switch (e.code) { case 'ENOENT': log.error(`File not found at: ${file}`); diff --git a/src/config/index.ts b/src/config/index.ts index 6bcab334..fc049b5a 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -332,11 +332,11 @@ function valueToString(value: unknown, name: string) { } } -function checkValueDecode( - decoded: Either, +function checkValueDecode( + decoded: Either, key: string, - value: unknown, -): decoded is Right { + value: T, +): decoded is Right { if (isLeft(decoded)) { throw new ConfigurationValidationError(key, value); } diff --git a/src/device-api/v2.ts b/src/device-api/v2.ts index f6609683..fe30541e 100644 --- a/src/device-api/v2.ts +++ b/src/device-api/v2.ts @@ -286,7 +286,7 @@ export function createV2Api(router: Router) { let apps: any; try { apps = await applicationManager.getLegacyState(); - } catch (e) { + } catch (e: any) { log.error(e.message); return res.status(500).json({ status: 'failed', @@ -358,7 +358,7 @@ export function createV2Api(router: Router) { status: 'success', message: 'OK', }); - } catch (e) { + } catch (e: any) { res.status(400).json({ status: 'failed', message: e.message, @@ -380,7 +380,7 @@ export function createV2Api(router: Router) { deviceType, }, }); - } catch (e) { + } catch (e: any) { res.status(500).json({ status: 'failed', message: e.message, @@ -536,7 +536,7 @@ export function createV2Api(router: Router) { status: 'success', tags, }); - } catch (e) { + } catch (e: any) { log.error(e); res.status(500).json({ status: 'failed', diff --git a/src/device-config.ts b/src/device-config.ts index e986f76c..4cd493d1 100644 --- a/src/device-config.ts +++ b/src/device-config.ts @@ -79,7 +79,7 @@ const actionExecutors: DeviceActionExecutors = { success: true, }); } - } catch (err) { + } catch (err: any) { if (step.humanReadableTarget) { logger.logConfigChange(step.humanReadableTarget, { err, @@ -102,7 +102,7 @@ const actionExecutors: DeviceActionExecutors = { if (!initial) { logger.logConfigChange(logValue, { success: true }); } - } catch (err) { + } catch (err: any) { logger.logConfigChange(logValue, { err }); throw err; } @@ -271,7 +271,7 @@ export async function getTarget({ let conf: Dictionary; try { conf = JSON.parse(devConfig.targetValues); - } catch (e) { + } catch (e: any) { throw new Error(`Corrupted supervisor database! Error: ${e.message}`); } if (initial || conf.SUPERVISOR_VPN_CONTROL == null) { @@ -697,7 +697,7 @@ async function isVPNEnabled(): Promise { try { const activeState = await dbus.serviceActiveState(vpnServiceName); return !_.includes(['inactive', 'deactivating'], activeState); - } catch (e) { + } catch (e: any) { if (UnitNotLoadedError(e)) { return false; } diff --git a/src/device-state.ts b/src/device-state.ts index 7c5a4f00..03a636e2 100644 --- a/src/device-state.ts +++ b/src/device-state.ts @@ -78,7 +78,7 @@ function createDeviceStateRouter() { try { const response = await executeStepAction({ action }, { force }); res.status(202).json(response); - } catch (e) { + } catch (e: any) { const status = e instanceof UpdatesLockedError ? 423 : 500; res.status(status).json({ Data: '', @@ -155,7 +155,7 @@ function createDeviceStateRouter() { validation.checkTruthy(req.body.force) || lockOverride, ); res.status(200).send('OK'); - } catch (err) { + } catch (err: any) { // TODO: We should be able to throw err if it's UpdatesLockedError // and the error middleware will handle it, but this doesn't work in // the test environment. Fix this when fixing API tests. @@ -194,7 +194,7 @@ function createDeviceStateRouter() { stateToSend.download_progress = service.download_progress; } res.json(stateToSend); - } catch (e) { + } catch (e: any) { res.status(500).json({ Data: '', Error: (e != null ? e.message : undefined) || e || 'Unknown error', @@ -772,7 +772,7 @@ export async function applyStep( skipLock, }); emitAsync('step-completed', null, step, stepResult || undefined); - } catch (e) { + } catch (e: any) { emitAsync('step-error', e, step); throw e; } @@ -918,7 +918,7 @@ export const applyTarget = async ({ nextDelay, retryCount, }); - } catch (e) { + } catch (e: any) { if (e instanceof UpdatesLockedError) { // Forward the UpdatesLockedError directly throw e; diff --git a/src/device-state/preload.ts b/src/device-state/preload.ts index 08e93be0..536d1bf7 100644 --- a/src/device-state/preload.ts +++ b/src/device-state/preload.ts @@ -57,7 +57,7 @@ export async function loadTargetFromFile(appsPath: string): Promise { let stateFromFile: AppsJsonFormat | any[]; try { stateFromFile = JSON.parse(content); - } catch (e) { + } catch (e: any) { throw new AppsJsonParseError(e); } @@ -157,7 +157,7 @@ export async function loadTargetFromFile(appsPath: string): Promise { } } return true; - } catch (e) { + } catch (e: any) { // Ensure that this is actually a file, and not an empty path // It can be an empty path because if the file does not exist // on host, the docker daemon creates an empty directory when diff --git a/src/device-state/target-state.ts b/src/device-state/target-state.ts index 4828e87c..f604afad 100644 --- a/src/device-state/target-state.ts +++ b/src/device-state/target-state.ts @@ -188,7 +188,7 @@ const poll = async ( await update(); // Reset fetchErrors because we successfuly updated fetchErrors = 0; - } catch (e) { + } catch { // Exponential back off if request fails pollInterval = Math.min(appUpdatePollInterval, 15000 * 2 ** fetchErrors); ++fetchErrors; diff --git a/src/host-config.ts b/src/host-config.ts index 7d939319..470f199f 100644 --- a/src/host-config.ts +++ b/src/host-config.ts @@ -67,7 +67,7 @@ async function readProxy(): Promise { let redsocksConf: string; try { redsocksConf = await fs.readFile(redsocksConfPath, 'utf-8'); - } catch (e) { + } catch (e: any) { if (!ENOENT(e)) { throw e; } @@ -99,7 +99,7 @@ async function readProxy(): Promise { if (noProxy.length) { conf.noProxy = noProxy; } - } catch (e) { + } catch (e: any) { if (!ENOENT(e)) { throw e; } @@ -141,7 +141,7 @@ async function setProxy(maybeConf: ProxyConfig | null): Promise { let currentConf: ProxyConfig | undefined; try { currentConf = await readProxy(); - } catch (err) { + } catch { // Noop - current redsocks.conf does not exist } diff --git a/src/lib/api-helper.ts b/src/lib/api-helper.ts index 23b40e18..bf0f86f6 100644 --- a/src/lib/api-helper.ts +++ b/src/lib/api-helper.ts @@ -59,7 +59,7 @@ export const fetchDevice = async ( } return device; - } catch (e) { + } catch { throw new DeviceNotFoundError(); } }; @@ -123,7 +123,7 @@ export const exchangeKeyAndGetDevice = async ( opts.provisioningApiKey, apiTimeout, ); - } catch (err) { + } catch { throw new ExchangeKeyError(`Couldn't fetch device with provisioning key`); } diff --git a/src/lib/contracts.ts b/src/lib/contracts.ts index d2fcec06..5e99a1b7 100644 --- a/src/lib/contracts.ts +++ b/src/lib/contracts.ts @@ -219,7 +219,7 @@ export function validateTargetContracts( service.labels?.['io.balena.features.optional'], ), }; - } catch (e) { + } catch (e: any) { throw new ContractValidationError(serviceName, e.message); } } diff --git a/src/lib/json.ts b/src/lib/json.ts index dbf9873d..feb87fd9 100644 --- a/src/lib/json.ts +++ b/src/lib/json.ts @@ -30,7 +30,7 @@ export function equals(value: T, other: T): boolean { * Returns true if the the object equals `{}` or is an empty * array */ -export function empty(value: T): boolean { +export function empty(value: T): boolean { return (Array.isArray(value) && value.length === 0) || equals(value, {}); } diff --git a/src/lib/legacy.ts b/src/lib/legacy.ts index 57878f16..bd16d19a 100644 --- a/src/lib/legacy.ts +++ b/src/lib/legacy.ts @@ -48,7 +48,7 @@ async function createVolumeFromLegacyData( {}, legacyPath, ); - } catch (e) { + } catch (e: any) { logger.logSystemMessage( `Warning: could not migrate legacy /data volume: ${e.message}`, { error: e }, @@ -85,7 +85,7 @@ export async function normaliseLegacyDatabase() { try { services = JSON.parse(app.services); - } catch (e) { + } catch (e: any) { throw new DatabaseParseError(e); } diff --git a/src/lib/lockfile.ts b/src/lib/lockfile.ts index 5e3e1c61..c80873db 100644 --- a/src/lib/lockfile.ts +++ b/src/lib/lockfile.ts @@ -126,7 +126,7 @@ export async function unlock(path: string): Promise { export function unlockSync(path: string) { try { return unlinkSync(path); - } catch (e) { + } catch (e: any) { if (e.code === 'EPERM' || e.code === 'EISDIR') { return rmdirSync(path); } diff --git a/src/lib/os-release.ts b/src/lib/os-release.ts index 9649363c..14adfa07 100644 --- a/src/lib/os-release.ts +++ b/src/lib/os-release.ts @@ -21,7 +21,7 @@ const getOSReleaseData = _.memoize( const value = _.trim(values.join('=')).replace(/^"(.+(?="$))"$/, '$1'); releaseItems[_.trim(key)] = value; } - } catch (e) { + } catch (e: any) { throw new InternalInconsistencyError( `Unable to read file at ${path}: ${e.message} ${e.stack}`, ); diff --git a/src/lib/update-lock.ts b/src/lib/update-lock.ts index d70a086a..559be231 100644 --- a/src/lib/update-lock.ts +++ b/src/lib/update-lock.ts @@ -112,7 +112,7 @@ export async function lock( let lockOverride: boolean; try { lockOverride = await config.get('lockOverride'); - } catch (err) { + } catch (err: any) { throw new InternalInconsistencyError( `Error getting lockOverride config value: ${err?.message ?? err}`, ); diff --git a/src/local-mode.ts b/src/local-mode.ts index 77dd0679..b134979a 100644 --- a/src/local-mode.ts +++ b/src/local-mode.ts @@ -161,7 +161,7 @@ export class LocalModeManager { return this.collectContainerResources( this.containerId || SUPERVISOR_CONTAINER_NAME_FALLBACK, ); - } catch (e) { + } catch (e: any) { if (this.containerId !== undefined) { try { // Inspect operation fails (container ID is out of sync?). @@ -172,7 +172,7 @@ export class LocalModeManager { e.message, ); return this.collectContainerResources(fallback); - } catch (e) { + } catch (e: any) { // Inspect operation fails (using legacy container name?). const fallback = SUPERVISOR_LEGACY_CONTAINER_NAME_FALLBACK; log.warn( @@ -230,7 +230,7 @@ export class LocalModeManager { EngineSnapshot.fromJSON(r.snapshot), LocalModeManager.parseTimestamp(r.timestamp), ); - } catch (e) { + } catch (e: any) { // Some parsing error happened. Ensure we add data details to the error description. throw new Error( `Cannot parse snapshot data ${JSON.stringify(r)}.` + diff --git a/src/migrations/20171129064057_multicontainer.js b/src/migrations/20171129064057_multicontainer.js index 08d6b239..3dae4610 100644 --- a/src/migrations/20171129064057_multicontainer.js +++ b/src/migrations/20171129064057_multicontainer.js @@ -4,7 +4,7 @@ const _ = require('lodash'); var tryParse = function (obj) { try { return JSON.parse(obj); - } catch (e) { + } catch { return {}; } }; diff --git a/src/migrations/20181907164000-endpoint-specific-logschannel.js b/src/migrations/20181907164000-endpoint-specific-logschannel.js index 6ee2cda9..495c2a60 100644 --- a/src/migrations/20181907164000-endpoint-specific-logschannel.js +++ b/src/migrations/20181907164000-endpoint-specific-logschannel.js @@ -22,7 +22,7 @@ exports.up = function (knex) { try { const parsed = JSON.parse(data.toString()); resolve(parsed); - } catch (e) { + } catch { console.log( 'Failed to parse config.json! Things may fail unexpectedly!', ); diff --git a/src/migrations/M00002.js b/src/migrations/M00002.js index 46d670ca..0166a27c 100644 --- a/src/migrations/M00002.js +++ b/src/migrations/M00002.js @@ -25,7 +25,7 @@ exports.up = function (knex) { return resolve(checkTruthy(parsed.localMode)); } return resolve(false); - } catch (e) { + } catch { console.log( 'Failed to parse config.json! Things may fail unexpectedly!', ); diff --git a/src/network.ts b/src/network.ts index 52eafcd3..db066567 100644 --- a/src/network.ts +++ b/src/network.ts @@ -46,7 +46,7 @@ export async function isVPNActive(): Promise { let active: boolean = true; try { await fs.lstat(`${constants.vpnStatusPath}/active`); - } catch (e) { + } catch { active = false; } log.info(`VPN connection is ${active ? 'active' : 'not active'}.`); diff --git a/src/proxyvisor.js b/src/proxyvisor.js index 6ee45305..00b74d0b 100644 --- a/src/proxyvisor.js +++ b/src/proxyvisor.js @@ -96,7 +96,7 @@ const createProxyvisorRouter = function (proxyvisor) { const fields = await db.models('dependentDevice').select(); const devices = fields.map(parseDeviceFields); res.json(devices); - } catch (err) { + } catch (/** @type {any} */ err) { res.status(503).send(err?.message || err || 'Unknown error'); } }); @@ -320,7 +320,7 @@ const createProxyvisorRouter = function (proxyvisor) { ); } res.sendFile(dest); - } catch (err) { + } catch (/** @type {any} */ err) { log.error(`Error on ${req.method} ${url.parse(req.url).pathname}`, err); return res.status(503).send(err?.message || err || 'Unknown error'); } @@ -337,7 +337,7 @@ const createProxyvisorRouter = function (proxyvisor) { config: JSON.parse(app.config ?? '{}'), })); res.json($apps); - } catch (err) { + } catch (/** @type {any} */ err) { log.error(`Error on ${req.method} ${url.parse(req.url).pathname}`, err); return res.status(503).send(err?.message || err || 'Unknown error'); } diff --git a/src/supervisor-api.ts b/src/supervisor-api.ts index bffe0275..45724193 100644 --- a/src/supervisor-api.ts +++ b/src/supervisor-api.ts @@ -58,7 +58,7 @@ export class SupervisorAPI { return res.status(500).send('Unhealthy'); } return res.sendStatus(200); - } catch (_e) { + } catch { log.error('Healthcheck failed'); return res.status(500).send('Unhealthy'); } diff --git a/sync/init.ts b/sync/init.ts index b37a457e..d0a267f1 100644 --- a/sync/init.ts +++ b/sync/init.ts @@ -109,7 +109,7 @@ export async function initDevice(opts: Opts) { opts.docker, true, ); - } catch (e) { + } catch { await Bluebird.delay(500); } } diff --git a/test/legacy/05-device-state.spec.ts b/test/legacy/05-device-state.spec.ts index 5bb29008..2155a5ff 100644 --- a/test/legacy/05-device-state.spec.ts +++ b/test/legacy/05-device-state.spec.ts @@ -113,7 +113,7 @@ describe('device-state', () => { try { await testDb.destroy(); - } catch (e) { + } catch { /* noop */ } sinon.restore(); diff --git a/test/legacy/21-supervisor-api.spec.ts b/test/legacy/21-supervisor-api.spec.ts index 2d099c14..5f48f3e2 100644 --- a/test/legacy/21-supervisor-api.spec.ts +++ b/test/legacy/21-supervisor-api.spec.ts @@ -39,7 +39,7 @@ describe('SupervisorAPI', () => { after(async () => { try { await api.stop(); - } catch (e) { + } catch (e: any) { if (e.message !== 'Server is not running.') { throw e; } @@ -170,7 +170,7 @@ describe('SupervisorAPI', () => { // Start each case with API stopped try { await api.stop(); - } catch (e) { + } catch (e: any) { if (e.message !== 'Server is not running.') { throw e; } diff --git a/test/legacy/22-local-mode.spec.ts b/test/legacy/22-local-mode.spec.ts index 455a7bf8..e146ac65 100644 --- a/test/legacy/22-local-mode.spec.ts +++ b/test/legacy/22-local-mode.spec.ts @@ -400,7 +400,7 @@ describe('LocalModeManager', () => { try { const result = await localMode.retrieveLatestSnapshot(); expect(result).to.not.exist; - } catch (e) { + } catch (e: any) { expect(e.message).to.match(/Cannot parse snapshot data.*"bad json"/); } }); @@ -416,7 +416,7 @@ describe('LocalModeManager', () => { try { const result = await localMode.retrieveLatestSnapshot(); expect(result).to.not.exist; - } catch (e) { + } catch (e: any) { expect(e.message).to.match( /Cannot parse snapshot data.*"bad timestamp"/, ); diff --git a/test/legacy/27-extlinux-config.spec.ts b/test/legacy/27-extlinux-config.spec.ts index 30e2aea2..2e6a4162 100644 --- a/test/legacy/27-extlinux-config.spec.ts +++ b/test/legacy/27-extlinux-config.spec.ts @@ -147,7 +147,7 @@ describe('Extlinux Configuration', () => { // Expect correct rejection from the given bad config try { await backend.getBootConfig(); - } catch (e) { + } catch (e: any) { expect(e.message).to.equal(badConfig.reason); } // Restore stub diff --git a/test/legacy/28-db-format.spec.ts b/test/legacy/28-db-format.spec.ts index 81ef7637..688bdfae 100644 --- a/test/legacy/28-db-format.spec.ts +++ b/test/legacy/28-db-format.spec.ts @@ -43,7 +43,7 @@ describe('db-format', () => { after(async () => { try { await testDb.destroy(); - } catch (e) { + } catch { /* noop */ } sinon.restore(); diff --git a/test/legacy/37-odmdata-config.spec.ts b/test/legacy/37-odmdata-config.spec.ts index c0b73f69..27e80a36 100644 --- a/test/legacy/37-odmdata-config.spec.ts +++ b/test/legacy/37-odmdata-config.spec.ts @@ -62,7 +62,7 @@ describe('ODMDATA Configuration', () => { try { // @ts-ignore accessing private value await backend.getFileHandle(testConfigPath); - } catch (e) { + } catch { // noop } // Check that correct message was logged @@ -104,7 +104,7 @@ describe('ODMDATA Configuration', () => { try { // @ts-ignore accessing private value backend.parseOptions(Buffer.from([0x1, 0x0, 0x0])); - } catch (e) { + } catch { // noop } // Check that correct message was logged diff --git a/test/legacy/41-device-api-v1.spec.ts b/test/legacy/41-device-api-v1.spec.ts index fabafdc3..222168e3 100644 --- a/test/legacy/41-device-api-v1.spec.ts +++ b/test/legacy/41-device-api-v1.spec.ts @@ -118,7 +118,7 @@ describe('SupervisorAPI [V1 Endpoints]', () => { after(async () => { try { await api.stop(); - } catch (e) { + } catch (e: any) { if (e.message !== 'Server is not running.') { throw e; } diff --git a/test/legacy/42-device-api-v2.spec.ts b/test/legacy/42-device-api-v2.spec.ts index 4d7e26d1..df8fd318 100644 --- a/test/legacy/42-device-api-v2.spec.ts +++ b/test/legacy/42-device-api-v2.spec.ts @@ -62,7 +62,7 @@ describe('SupervisorAPI [V2 Endpoints]', () => { after(async () => { try { await api.stop(); - } catch (e) { + } catch (e: any) { if (e.message !== 'Server is not running.') { throw e; } diff --git a/test/legacy/src/compose/application-manager.spec.ts b/test/legacy/src/compose/application-manager.spec.ts index e054382b..1f6e2238 100644 --- a/test/legacy/src/compose/application-manager.spec.ts +++ b/test/legacy/src/compose/application-manager.spec.ts @@ -195,7 +195,7 @@ describe('compose/application-manager', () => { after(async () => { try { await testDb.destroy(); - } catch (e) { + } catch { /* noop */ } // Restore stubbed methods diff --git a/test/lib/mocked-dockerode.ts b/test/lib/mocked-dockerode.ts index 2431f307..3eda021d 100644 --- a/test/lib/mocked-dockerode.ts +++ b/test/lib/mocked-dockerode.ts @@ -207,7 +207,7 @@ function createMockedDockerode(data: TestData) { return mockedDockerode; } -type Prototype = Dictionary<(...args: any[]) => any>; +type Prototype = { [key: string]: any }; function clonePrototype(prototype: Prototype): Prototype { const clone: Prototype = {}; Object.getOwnPropertyNames(prototype).forEach((fn) => { diff --git a/test/lib/mockerode.ts b/test/lib/mockerode.ts index 3e661eea..b38ac51d 100644 --- a/test/lib/mockerode.ts +++ b/test/lib/mockerode.ts @@ -47,7 +47,9 @@ function createFake(prototype: Prototype) { ...res, [fn]: () => { throw Error( - `Fake method not implemented: ${prototype.constructor.name}.${fn}()`, + `Fake method not implemented: ${ + prototype.constructor.name + }.${fn.toString()}()`, ); }, }), diff --git a/test/lib/prepare.ts b/test/lib/prepare.ts index 68140f46..92b09952 100644 --- a/test/lib/prepare.ts +++ b/test/lib/prepare.ts @@ -24,13 +24,13 @@ export = async function () { try { fs.unlinkSync(process.env.DATABASE_PATH_2!); - } catch (e) { + } catch { /* ignore /*/ } try { fs.unlinkSync(process.env.DATABASE_PATH_3!); - } catch (e) { + } catch { /* ignore /*/ } @@ -58,7 +58,7 @@ export = async function () { './test/data/config-apibinder-offline2.json', fs.readFileSync('./test/data/testconfig-apibinder-offline2.json'), ); - } catch (e) { + } catch { /* ignore /*/ } diff --git a/webpack.config.js b/webpack.config.js index e086a38c..8b09eb05 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -38,7 +38,7 @@ const lookForOptionalDeps = function (sourceDir) { packageJson = JSON.parse( fs.readFileSync(path.join(sourceDir, dir, '/package.json'), 'utf8'), ); - } catch (e) { + } catch { continue; } if (packageJson.optionalDependencies != null) { From 96418d55b5507d8352e612d4a8074e700ea0780a Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Mon, 19 Sep 2022 16:33:52 +0100 Subject: [PATCH 2/2] Update @balena/lint to 6.2.0 Change-type: patch --- package-lock.json | 1052 +++++++++++------ package.json | 6 +- src/api-binder/index.ts | 15 +- src/api-binder/report.ts | 6 +- src/compose/app.ts | 36 +- src/compose/application-manager.ts | 10 +- src/compose/images.ts | 25 +- src/compose/network.ts | 8 +- src/compose/ports.ts | 3 +- src/compose/service-manager.ts | 16 +- src/compose/service.ts | 14 +- src/compose/utils.ts | 21 +- src/compose/volume.ts | 7 +- src/config/backends/extra-uEnv.ts | 6 +- src/config/backends/odmdata.ts | 9 +- src/config/configJson.ts | 6 +- src/config/index.ts | 16 +- src/device-state.ts | 17 +- src/device-state/db-format.ts | 109 +- src/device-state/target-state.ts | 30 +- src/event-tracker.ts | 14 +- src/lib/api-helper.ts | 4 +- src/lib/api-keys.ts | 2 +- src/lib/docker-utils.ts | 7 +- src/lib/legacy.ts | 122 +- src/lib/supervisor-console.ts | 4 +- src/lib/update-lock.ts | 8 +- src/logging/monitor.ts | 5 +- src/network.ts | 3 +- src/proxyvisor.js | 5 +- src/types/basic.ts | 2 +- test/integration/lib/lockfile.spec.ts | 2 +- test/legacy/02-db.spec.ts | 6 +- test/legacy/08-event-tracker.spec.ts | 10 +- test/legacy/09-network.spec.ts | 2 +- test/legacy/10-api-binder.spec.ts | 4 +- test/legacy/11-logger.spec.ts | 4 +- test/legacy/12-device-config.spec.ts | 11 +- test/legacy/14-conversions.spec.ts | 6 +- test/legacy/15-ports.spec.ts | 2 +- test/legacy/21-supervisor-api.spec.ts | 10 +- test/legacy/22-local-mode.spec.ts | 7 +- test/legacy/23-contracts.spec.ts | 78 +- test/legacy/24-deltas.spec.ts | 3 +- test/legacy/27-extlinux-config.spec.ts | 15 +- test/legacy/30-fdt-directive.spec.ts | 2 +- test/legacy/33-extra-uenv-config.spec.ts | 23 +- test/legacy/37-odmdata-config.spec.ts | 33 +- test/legacy/41-device-api-v1.spec.ts | 16 +- test/legacy/src/compose/app.spec.ts | 18 +- .../src/compose/application-manager.spec.ts | 684 +++++------ test/legacy/src/compose/images.spec.ts | 36 +- test/legacy/src/lib/update-lock.spec.ts | 6 +- test/lib/db-helper.ts | 4 +- test/lib/mocked-database.ts | 4 +- test/lib/mocked-device-api.ts | 3 +- test/lib/mocked-dockerode.ts | 2 +- test/lib/mockerode.ts | 52 +- test/unit/lib/fs-utils.spec.ts | 6 +- test/unit/lib/system-info.spec.ts | 1 - 60 files changed, 1432 insertions(+), 1206 deletions(-) diff --git a/package-lock.json b/package-lock.json index 094b4ebc..62ecf0b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,58 +14,60 @@ } }, "@babel/generator": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.6.tgz", - "integrity": "sha512-+htwWKJbH2bL72HRluF8zumBxzuX0ZZUFl3JLNyoUjM/Ho8wnVpPXM6aUz8cfKDqQ/h7zHqKt4xzJteUosckqQ==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", + "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", "dev": true, "requires": { - "@babel/types": "^7.9.6", - "jsesc": "^2.5.1", - "lodash": "^4.17.13", - "source-map": "^0.5.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } + "@babel/types": "^7.19.0", + "@jridgewell/gen-mapping": "^0.3.2", + "jsesc": "^2.5.1" } }, + "@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "dev": true + }, "@babel/helper-function-name": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz", - "integrity": "sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", + "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.8.3", - "@babel/template": "^7.8.3", - "@babel/types": "^7.9.5" + "@babel/template": "^7.18.10", + "@babel/types": "^7.19.0" } }, - "@babel/helper-get-function-arity": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", - "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "dev": true, "requires": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.18.6" } }, "@babel/helper-split-export-declaration": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", - "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "dev": true, "requires": { - "@babel/types": "^7.8.3" + "@babel/types": "^7.18.6" } }, + "@babel/helper-string-parser": { + "version": "7.18.10", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", + "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "dev": true + }, "@babel/helper-validator-identifier": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", - "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true }, "@babel/highlight": { @@ -80,9 +82,9 @@ } }, "@babel/parser": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.6.tgz", - "integrity": "sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q==", + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", + "integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==", "dev": true }, "@babel/runtime": { @@ -95,48 +97,97 @@ } }, "@babel/template": { - "version": "7.8.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", - "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "version": "7.18.10", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", + "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", "dev": true, "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/parser": "^7.8.6", - "@babel/types": "^7.8.6" + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.18.10", + "@babel/types": "^7.18.10" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "dev": true, + "requires": { + "@babel/highlight": "^7.18.6" + } + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", + "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", + "dev": true + } } }, "@babel/traverse": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.6.tgz", - "integrity": "sha512-b3rAHSjbxy6VEAvlxM8OV/0X4XrG72zoxme6q1MOoe2vd0bEc+TwayhuC1+Dfgqh1QEG+pj7atQqvUprHIccsg==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", + "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", "dev": true, "requires": { - "@babel/code-frame": "^7.8.3", - "@babel/generator": "^7.9.6", - "@babel/helper-function-name": "^7.9.5", - "@babel/helper-split-export-declaration": "^7.8.3", - "@babel/parser": "^7.9.6", - "@babel/types": "^7.9.6", + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.19.0", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.19.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.19.1", + "@babel/types": "^7.19.0", "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.13" + "globals": "^11.1.0" }, "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dev": true, "requires": { - "ms": "^2.1.1" + "@babel/highlight": "^7.18.6" } }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", + "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", "dev": true }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -146,13 +197,13 @@ } }, "@babel/types": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.6.tgz", - "integrity": "sha512-qxXzvBO//jO9ZnoasKF1uJzHd2+M6Q2ZPIVfnFps8JJvXy0ZBbwbNOmE6SGIY5XOY6d1Bo5lb9d9RJ8nv3WSeA==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", + "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.9.5", - "lodash": "^4.17.13", + "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-validator-identifier": "^7.18.6", "to-fast-properties": "^2.0.0" } }, @@ -501,54 +552,166 @@ } }, "@balena/lint": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.1.0.tgz", - "integrity": "sha512-ktyLx8bi2PwhED7KYKyi93RhpS9mI5X2KHA076hcpr/fD8W+XQF5DBga8Y40oNrt+qG8ZjVyMMXA3vvuVAslRA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-6.2.0.tgz", + "integrity": "sha512-/17R2TAYIrjryiNUBVaDrFyeU5OQwTNybTo/gllJpR8DLa5+vnYGelCm+igHMU10u4wMgJVLz8SBNrEbaDW5iw==", "dev": true, "requires": { - "@types/glob": "^7.1.1", - "@types/lodash": "^4.14.150", - "@types/node": "^10.17.21", - "@types/optimist": "0.0.29", - "@types/prettier": "^2.0.0", - "coffee-script": "^1.10.0", - "coffeelint": "^1.15.0", - "coffeescope2": "^0.4.5", - "depcheck": "^0.9.2", - "glob": "^7.1.6", - "lodash": "^4.17.15", - "optimist": "^0.6.1", - "prettier": "^2.0.5", - "tslint": "^6.1.2", + "@types/glob": "^7.1.3", + "@types/node": "^12.20.13", + "@types/prettier": "^2.2.3", + "depcheck": "^1.4.1", + "glob": "^7.1.7", + "prettier": "^2.3.0", + "tslint": "^6.1.3", "tslint-config-prettier": "^1.18.0", "tslint-no-unused-expression-chai": "^0.1.4", - "typescript": "^3.9.2" + "typescript": "^4.2.4", + "yargs": "^16.2.0" }, "dependencies": { + "@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==", + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, - "typescript": { - "version": "3.9.9", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", - "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true } } @@ -570,6 +733,45 @@ "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "optional": true }, + "@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", + "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "@leichtgewicht/ip-codec": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz", @@ -1042,12 +1244,6 @@ "integrity": "sha512-RW3VRiuQIMo5PJ4Q1IwBtdLHL/t8ACpzUY40norN9ejE6CUBwKetmSxJnITJ0NlzN/ymF1nvPvlpvegtns7yOg==", "dev": true }, - "@types/optimist": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/optimist/-/optimist-0.0.29.tgz", - "integrity": "sha1-qIc1gLOoS2msHmhzI7Ffu+uQR5o=", - "dev": true - }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", @@ -1055,9 +1251,9 @@ "dev": true }, "@types/prettier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.0.0.tgz", - "integrity": "sha512-/rM+sWiuOZ5dvuVzV37sUuklsbg+JPOP8d+nNFlo2ZtfpzPiPvh1/gc8liWOLBqe+sR+ZM7guPaIcTt6UZTo7Q==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.0.tgz", + "integrity": "sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==", "dev": true }, "@types/range-parser": { @@ -1286,6 +1482,75 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, + "@vue/compiler-core": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.39.tgz", + "integrity": "sha512-mf/36OWXqWn0wsC40nwRRGheR/qoID+lZXbIuLnr4/AngM0ov8Xvv8GHunC0rKRIkh60bTqydlqTeBo49rlbqw==", + "dev": true, + "requires": { + "@babel/parser": "^7.16.4", + "@vue/shared": "3.2.39", + "estree-walker": "^2.0.2", + "source-map": "^0.6.1" + } + }, + "@vue/compiler-dom": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.39.tgz", + "integrity": "sha512-HMFI25Be1C8vLEEv1hgEO1dWwG9QQ8LTTPmCkblVJY/O3OvWx6r1+zsox5mKPMGvqYEZa6l8j+xgOfUspgo7hw==", + "dev": true, + "requires": { + "@vue/compiler-core": "3.2.39", + "@vue/shared": "3.2.39" + } + }, + "@vue/compiler-sfc": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.39.tgz", + "integrity": "sha512-fqAQgFs1/BxTUZkd0Vakn3teKUt//J3c420BgnYgEOoVdTwYpBTSXCMJ88GOBCylmUBbtquGPli9tVs7LzsWIA==", + "dev": true, + "requires": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.39", + "@vue/compiler-dom": "3.2.39", + "@vue/compiler-ssr": "3.2.39", + "@vue/reactivity-transform": "3.2.39", + "@vue/shared": "3.2.39", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7", + "postcss": "^8.1.10", + "source-map": "^0.6.1" + } + }, + "@vue/compiler-ssr": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.39.tgz", + "integrity": "sha512-EoGCJ6lincKOZGW+0Ky4WOKsSmqL7hp1ZYgen8M7u/mlvvEQUaO9tKKOy7K43M9U2aA3tPv0TuYYQFrEbK2eFQ==", + "dev": true, + "requires": { + "@vue/compiler-dom": "3.2.39", + "@vue/shared": "3.2.39" + } + }, + "@vue/reactivity-transform": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.39.tgz", + "integrity": "sha512-HGuWu864zStiWs9wBC6JYOP1E00UjMdDWIG5W+FpUx28hV3uz9ODOKVNm/vdOy/Pvzg8+OcANxAVC85WFBbl3A==", + "dev": true, + "requires": { + "@babel/parser": "^7.16.4", + "@vue/compiler-core": "3.2.39", + "@vue/shared": "3.2.39", + "estree-walker": "^2.0.2", + "magic-string": "^0.25.7" + } + }, + "@vue/shared": { + "version": "3.2.39", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.39.tgz", + "integrity": "sha512-D3dl2ZB9qE6mTuWPk9RlhDeP1dgNRUKC3NJxji74A4yL8M2MwlhLKUC/49WHjrNzSPug58fWx/yFbaTzGAQSBw==", + "dev": true + }, "@webassemblyjs/ast": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", @@ -1743,6 +2008,12 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, "array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", @@ -1779,6 +2050,12 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -2455,9 +2732,9 @@ "optional": true }, "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", "dev": true }, "builtin-status-codes": { @@ -2630,32 +2907,6 @@ "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", "dev": true }, - "caller-callsite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", - "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", - "dev": true, - "requires": { - "callsites": "^2.0.0" - }, - "dependencies": { - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - } - } - }, - "caller-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", - "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", - "dev": true, - "requires": { - "caller-callsite": "^2.0.0" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2992,55 +3243,6 @@ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, - "coffee-script": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", - "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", - "dev": true - }, - "coffeelint": { - "version": "1.16.2", - "resolved": "https://registry.npmjs.org/coffeelint/-/coffeelint-1.16.2.tgz", - "integrity": "sha512-6mzgOo4zb17WfdrSui/cSUEgQ0AQkW3gXDht+6lHkfkqGUtSYKwGdGcXsDfAyuScVzTlTtKdfwkAlJWfqul7zg==", - "dev": true, - "requires": { - "coffee-script": "~1.11.0", - "glob": "^7.0.6", - "ignore": "^3.0.9", - "optimist": "^0.6.1", - "resolve": "^0.6.3", - "strip-json-comments": "^1.0.2" - }, - "dependencies": { - "coffee-script": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.11.1.tgz", - "integrity": "sha1-vxxHrWREOg2V0S3ysUfMCk2q1uk=", - "dev": true - }, - "resolve": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-0.6.3.tgz", - "integrity": "sha1-3ZV5gufnNt699TtYpN2RdUV13UY=", - "dev": true - }, - "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", - "dev": true - } - } - }, - "coffeescope2": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/coffeescope2/-/coffeescope2-0.4.6.tgz", - "integrity": "sha1-FH8CcBXRWCP5eFl6uaEJQYGkHb0=", - "dev": true, - "requires": { - "globals": "^10.1.0" - } - }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -3122,9 +3324,9 @@ } }, "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "common-tags": { @@ -3516,12 +3718,6 @@ "nan": "^2.14.0" } }, - "de-indent": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", - "integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=", - "dev": true - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -3655,85 +3851,207 @@ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" }, "depcheck": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/depcheck/-/depcheck-0.9.2.tgz", - "integrity": "sha512-w5f+lSZqLJJkk58s44eOd0Vor7hLZot4PlFL0y2JsIX5LuHQ2eAjHlDVeGBD4Mj6ZQSKakvKWRRCcPlvrdU2Sg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/depcheck/-/depcheck-1.4.3.tgz", + "integrity": "sha512-vy8xe1tlLFu7t4jFyoirMmOR7x7N601ubU9Gkifyr9z8rjBFtEdWHDBMqXyk6OkK+94NXutzddVXJuo0JlUQKQ==", "dev": true, "requires": { - "@babel/parser": "^7.7.7", - "@babel/traverse": "^7.7.4", - "builtin-modules": "^3.0.0", - "camelcase": "^5.3.1", - "cosmiconfig": "^5.2.1", - "debug": "^4.1.1", + "@babel/parser": "7.16.4", + "@babel/traverse": "^7.12.5", + "@vue/compiler-sfc": "^3.0.5", + "camelcase": "^6.2.0", + "cosmiconfig": "^7.0.0", + "debug": "^4.2.0", "deps-regex": "^0.1.4", - "js-yaml": "^3.4.2", - "lodash": "^4.17.15", - "minimatch": "^3.0.2", - "node-sass-tilde-importer": "^1.0.2", + "ignore": "^5.1.8", + "is-core-module": "^2.4.0", + "js-yaml": "^3.14.0", + "json5": "^2.1.3", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "multimatch": "^5.0.0", "please-upgrade-node": "^3.2.0", + "query-ast": "^1.0.3", + "readdirp": "^3.5.0", "require-package-name": "^2.0.1", - "resolve": "^1.14.1", - "vue-template-compiler": "^2.6.11", - "walkdir": "^0.4.1", - "yargs": "^15.0.2" + "resolve": "^1.18.1", + "sass": "^1.29.0", + "scss-parser": "^1.0.4", + "semver": "^7.3.2", + "yargs": "^16.1.0" }, "dependencies": { - "cosmiconfig": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", - "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.13.1", - "parse-json": "^4.0.0" + "color-convert": "^2.0.1" + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" } }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, - "import-fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", - "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, + "json5": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", + "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { - "path-parse": "^1.0.6" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true } } }, @@ -3745,7 +4063,7 @@ "deps-regex": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deps-regex/-/deps-regex-0.1.4.tgz", - "integrity": "sha1-UYZnt2kUYKXn4KNBvnbrfOgJAYQ=", + "integrity": "sha512-3tzwGYogSJi8HoG93R5x9NrdefZQOXgHgGih/7eivloOq6yC6O+yoFxZnkgP661twvfILONfoKRdF9GQOGx2RA==", "dev": true }, "des.js": { @@ -4577,6 +4895,12 @@ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -5101,12 +5425,6 @@ } } }, - "find-parent-dir": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", - "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", - "dev": true - }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -5626,9 +5944,9 @@ } }, "globals": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-10.4.0.tgz", - "integrity": "sha512-uNUtxIZpGyuaq+5BqGGQHsL4wUlJAXRqOm6g3Y48/CWNGTLONgBibI0lh6lGxjR2HljFYUfszb+mk4WkgMntsA==", + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, "globby": { @@ -5848,12 +6166,6 @@ "minimalistic-assert": "^1.0.1" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -6085,9 +6397,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "ignore-by-default": { @@ -6096,6 +6408,12 @@ "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", "dev": true }, + "immutable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", + "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "dev": true + }, "import-fresh": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", @@ -6314,6 +6632,15 @@ "integrity": "sha512-e0/LknJ8wpMMhTiWcjivB+ESwIuvHnBSlBbmP/pSb8CQJldoj1p2qv7xGZ/+BtbTziYRFSz8OsvdbiX45LtYQA==", "dev": true }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, "io-ts": { "version": "2.2.10", "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.10.tgz", @@ -6398,6 +6725,15 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -6437,12 +6773,6 @@ } } }, - "is-directory": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", - "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", - "dev": true - }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -7365,6 +7695,15 @@ } } }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -7395,6 +7734,15 @@ "es5-ext": "~0.10.2" } }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -7759,12 +8107,6 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, "minipass": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", @@ -8464,6 +8806,19 @@ "thunky": "^1.0.2" } }, + "multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -8845,15 +9200,6 @@ } } }, - "node-sass-tilde-importer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/node-sass-tilde-importer/-/node-sass-tilde-importer-1.0.2.tgz", - "integrity": "sha512-Swcmr38Y7uB78itQeBm3mThjxBy9/Ah/ykPIaURY/L6Nec9AyRoL/jJ7ECfMR+oZeCTVQNxVMu/aHU+TLRVbdg==", - "dev": true, - "requires": { - "find-parent-dir": "^0.3.0" - } - }, "node-watch": { "version": "0.5.9", "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.5.9.tgz", @@ -9113,16 +9459,6 @@ "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", "dev": true }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -9397,6 +9733,12 @@ "integrity": "sha512-bhlV7Eq09JrRIvo1eKngpwuqKtJnNhZdpdOlvrPrA4dxqXPjxSrbNrfnIDmTpwMyRszrcV4kU5ZA4mMsQUrjdg==", "dev": true }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, "picomatch": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.0.7.tgz", @@ -9478,6 +9820,25 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, + "postcss": { + "version": "8.4.16", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", + "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", + "dev": true, + "requires": { + "nanoid": "^3.3.4", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "dependencies": { + "nanoid": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "dev": true + } + } + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -9491,9 +9852,9 @@ "dev": true }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "dev": true }, "pretty-ms": { @@ -9654,6 +10015,15 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "query-ast": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/query-ast/-/query-ast-1.0.4.tgz", + "integrity": "sha512-KFJFSvODCBjIH5HbHvITj9EEZKYUU6VX0T5CuB1ayvjUoUaZkKMi6eeby5Tf8DMukyZHlJQOE1+f3vevKUe6eg==", + "dev": true, + "requires": { + "invariant": "2.2.4" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -9906,7 +10276,7 @@ "require-package-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/require-package-name/-/require-package-name-2.0.1.tgz", - "integrity": "sha1-wR6XJ2tluOKSP3Xav1+y7ww4Qbk=", + "integrity": "sha512-uuoJ1hU/k6M0779t3VMVIYpb2VMJk05cehCaABFhXaibcbvfgR8wKiozLjVFSzJPmQMRqIcO0HMyTFqfV09V6Q==", "dev": true }, "resin-docker-build": { @@ -10153,6 +10523,17 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sass": { + "version": "1.54.9", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.54.9.tgz", + "integrity": "sha512-xb1hjASzEH+0L0WI9oFjqhRi51t/gagWnxLiwUNMltA0Ab6jIDkAacgKiGYKM9Jhy109osM7woEEai6SXeJo5Q==", + "dev": true, + "requires": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + } + }, "schema-utils": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", @@ -10184,6 +10565,15 @@ } } }, + "scss-parser": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/scss-parser/-/scss-parser-1.0.5.tgz", + "integrity": "sha512-RZOtvCmCnwkDo7kdcYBi807Y5EoTIxJ34AgEgJNDmOH1jl0/xG0FyYZFbH6Ga3Iwu7q8LSdxJ4C5UkzNXjQxKQ==", + "dev": true, + "requires": { + "invariant": "2.2.4" + } + }, "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", @@ -10689,6 +11079,12 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, "source-map-resolve": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", @@ -10718,6 +11114,12 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, "split": { "version": "0.3.3", "resolved": "http://registry.npmjs.org/split/-/split-0.3.3.tgz", @@ -11071,6 +11473,12 @@ "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "systeminformation": { "version": "5.6.10", "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.6.10.tgz", @@ -11463,7 +11871,7 @@ "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", "dev": true }, "to-object-path": { @@ -11678,9 +12086,9 @@ "dev": true }, "tslint": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.2.tgz", - "integrity": "sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", + "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -11694,16 +12102,10 @@ "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.10.0", + "tslib": "^1.13.0", "tsutils": "^2.29.0" }, "dependencies": { - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -11711,12 +12113,14 @@ "dev": true }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "requires": { - "path-parse": "^1.0.6" + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "semver": { @@ -11726,9 +12130,9 @@ "dev": true }, "tslib": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", - "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true } } @@ -11749,9 +12153,9 @@ }, "dependencies": { "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -12199,22 +12603,6 @@ "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==", "dev": true }, - "vue-template-compiler": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz", - "integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==", - "dev": true, - "requires": { - "de-indent": "^1.0.2", - "he": "^1.1.0" - } - }, - "walkdir": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz", - "integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==", - "dev": true - }, "watchpack": { "version": "1.7.4", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz", @@ -12962,12 +13350,6 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - }, "worker-farm": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", diff --git a/package.json b/package.json index 4d894302..d177062f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "start": "./entry.sh", "build": "npm run clean && npm run release && webpack", - "lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js", + "lint": "balena-lint -e ts -e js src/ test/ typings/ build-utils/ webpack.config.js", "test:build": "tsc --noEmit && tsc --noEmit --project tsconfig.js.json", "test:unit": "mocha --config test/unit/.mocharc.js", "test:integration": "mocha --config test/integration/.mocharc.js", @@ -20,7 +20,7 @@ "test:compose": "docker-compose -f docker-compose.yml -f docker-compose.test.yml up --build --remove-orphans --exit-code-from=sut ; npm run compose:down", "test": "npm run lint && npm run test:build && npm run test:unit && npm run test:legacy", "compose:down": "docker-compose -f docker-compose.test.yml down", - "prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js", + "prettify": "balena-lint -e ts -e js --fix src/ test/ typings/ build-utils/ webpack.config.js", "release": "tsc --project tsconfig.release.json && mv build/src/* build", "sync": "ts-node --files sync/sync.ts", "clean": "rimraf build", @@ -42,7 +42,7 @@ "devDependencies": { "@balena/contrato": "^0.6.0", "@balena/es-version": "^1.0.1", - "@balena/lint": "^5.1.0", + "@balena/lint": "^6.2.0", "@types/bluebird": "^3.5.32", "@types/chai": "^4.2.16", "@types/chai-as-promised": "^7.1.3", diff --git a/src/api-binder/index.ts b/src/api-binder/index.ts index d6e57ef6..e206ba9c 100644 --- a/src/api-binder/index.ts +++ b/src/api-binder/index.ts @@ -46,15 +46,12 @@ interface DeviceTag { let readyForUpdates = false; export async function healthcheck() { - const { - appUpdatePollInterval, - unmanaged, - connectivityCheckEnabled, - } = await config.getMany([ - 'appUpdatePollInterval', - 'unmanaged', - 'connectivityCheckEnabled', - ]); + const { appUpdatePollInterval, unmanaged, connectivityCheckEnabled } = + await config.getMany([ + 'appUpdatePollInterval', + 'unmanaged', + 'connectivityCheckEnabled', + ]); // Don't have to perform checks for unmanaged if (unmanaged) { diff --git a/src/api-binder/report.ts b/src/api-binder/report.ts index d660feb9..e7429336 100644 --- a/src/api-binder/report.ts +++ b/src/api-binder/report.ts @@ -57,9 +57,9 @@ async function report({ body, opts }: StateReport) { body, }; - const [ - { statusCode, body: statusMessage, headers }, - ] = await request.patchAsync(endpoint, params).timeout(apiTimeout); + const [{ statusCode, body: statusMessage, headers }] = await request + .patchAsync(endpoint, params) + .timeout(apiTimeout); if (statusCode < 200 || statusCode >= 300) { throw new StatusError( diff --git a/src/compose/app.ts b/src/compose/app.ts index 07709bb9..ed6ddd1a 100644 --- a/src/compose/app.ts +++ b/src/compose/app.ts @@ -750,25 +750,21 @@ export class App { }, ); - const [ - opts, - supervisorApiHost, - hostPathExists, - hostname, - ] = await Promise.all([ - config.get('extendedEnvOptions'), - dockerUtils - .getNetworkGateway(constants.supervisorNetworkInterface) - .catch(() => '127.0.0.1'), - (async () => ({ - firmware: await pathExistsOnHost('/lib/firmware'), - modules: await pathExistsOnHost('/lib/modules'), - }))(), - ( - (await config.get('hostname')) ?? - (await fs.readFile('/etc/hostname', 'utf-8')) - ).trim(), - ]); + const [opts, supervisorApiHost, hostPathExists, hostname] = + await Promise.all([ + config.get('extendedEnvOptions'), + dockerUtils + .getNetworkGateway(constants.supervisorNetworkInterface) + .catch(() => '127.0.0.1'), + (async () => ({ + firmware: await pathExistsOnHost('/lib/firmware'), + modules: await pathExistsOnHost('/lib/modules'), + }))(), + ( + (await config.get('hostname')) ?? + (await fs.readFile('/etc/hostname', 'utf-8')) + ).trim(), + ]); const svcOpts = { appName: app.name, @@ -824,7 +820,7 @@ export class App { // FIXME: Typings for DeviceMetadata return await Service.fromComposeObject( svc, - (thisSvcOpts as unknown) as DeviceMetadata, + thisSvcOpts as unknown as DeviceMetadata, ); }), ); diff --git a/src/compose/application-manager.ts b/src/compose/application-manager.ts index 51671013..5746bda9 100644 --- a/src/compose/application-manager.ts +++ b/src/compose/application-manager.ts @@ -51,12 +51,10 @@ type ApplicationManagerEventEmitter = StrictEventEmitter< const events: ApplicationManagerEventEmitter = new EventEmitter(); export const on: typeof events['on'] = events.on.bind(events); export const once: typeof events['once'] = events.once.bind(events); -export const removeListener: typeof events['removeListener'] = events.removeListener.bind( - events, -); -export const removeAllListeners: typeof events['removeAllListeners'] = events.removeAllListeners.bind( - events, -); +export const removeListener: typeof events['removeListener'] = + events.removeListener.bind(events); +export const removeAllListeners: typeof events['removeAllListeners'] = + events.removeAllListeners.bind(events); const proxyvisor = new Proxyvisor(); const localModeManager = new LocalModeManager(); diff --git a/src/compose/images.ts b/src/compose/images.ts index a4aa774b..5171cbe3 100644 --- a/src/compose/images.ts +++ b/src/compose/images.ts @@ -70,17 +70,14 @@ const events = new ImageEventEmitter(); export const on: typeof events['on'] = events.on.bind(events); export const once: typeof events['once'] = events.once.bind(events); -export const removeListener: typeof events['removeListener'] = events.removeListener.bind( - events, -); -export const removeAllListeners: typeof events['removeAllListeners'] = events.removeAllListeners.bind( - events, -); +export const removeListener: typeof events['removeListener'] = + events.removeListener.bind(events); +export const removeAllListeners: typeof events['removeAllListeners'] = + events.removeAllListeners.bind(events); const imageFetchFailures: Dictionary = {}; -const imageFetchLastFailureTime: Dictionary> = {}; +const imageFetchLastFailureTime: Dictionary> = + {}; const imageCleanupFailures: Dictionary = {}; type ImageState = Pick; @@ -538,9 +535,11 @@ async function getImagesForCleanup(): Promise { // for images with deltas this should return unless there is some inconsistency // and the tag was deleted. const inspectByReference = async (imageName: string) => { - const { registry, imageName: name, tagName } = dockerUtils.getRegistryAndName( - imageName, - ); + const { + registry, + imageName: name, + tagName, + } = dockerUtils.getRegistryAndName(imageName); const repo = [registry, name].filter((s) => !!s).join('/'); const reference = [repo, tagName].filter((s) => !!s).join(':'); @@ -781,7 +780,7 @@ async function fetchDelta( ): Promise { logger.logSystemEvent(LogTypes.downloadImageDelta, { image }); - const deltaOpts = (opts as unknown) as DeltaFetchOptions; + const deltaOpts = opts as unknown as DeltaFetchOptions; const srcImage = await inspectByName(deltaOpts.deltaSource); deltaOpts.deltaSourceId = srcImage.Id; diff --git a/src/compose/network.ts b/src/compose/network.ts index d19f7c56..8345aa65 100644 --- a/src/compose/network.ts +++ b/src/compose/network.ts @@ -20,9 +20,11 @@ export class Network { private constructor() {} - private static deconstructDockerName( - name: string, - ): { name: string; appId?: number; appUuid?: string } { + private static deconstructDockerName(name: string): { + name: string; + appId?: number; + appUuid?: string; + } { const matchWithAppId = name.match(/^(\d+)_(\S+)/); if (matchWithAppId == null) { const matchWithAppUuid = name.match(/^([0-9a-f-A-F]{32,})_(\S+)/); diff --git a/src/compose/ports.ts b/src/compose/ports.ts index 51b535dc..aa309f05 100644 --- a/src/compose/ports.ts +++ b/src/compose/ports.ts @@ -2,7 +2,8 @@ import * as _ from 'lodash'; import { TypedError } from 'typed-error'; // Adapted from https://github.com/docker/docker-py/blob/master/docker/utils/ports.py#L3 -const PORTS_REGEX = /^(?:(?:([a-fA-F\d.:]+):)?([\d]*)(?:-([\d]+))?:)?([\d]+)(?:-([\d]+))?(?:\/(udp|tcp))?$/; +const PORTS_REGEX = + /^(?:(?:([a-fA-F\d.:]+):)?([\d]*)(?:-([\d]+))?:)?([\d]+)(?:-([\d]+))?(?:\/(udp|tcp))?$/; // A regex to extract the protocol and internal port of the incoming Docker options const DOCKER_OPTS_PORTS_REGEX = /(\d+)(?:\/?([a-z]+))?/i; diff --git a/src/compose/service-manager.ts b/src/compose/service-manager.ts index 4a1eea52..da15a261 100644 --- a/src/compose/service-manager.ts +++ b/src/compose/service-manager.ts @@ -43,12 +43,10 @@ interface KillOpts { export const on: typeof events['on'] = events.on.bind(events); export const once: typeof events['once'] = events.once.bind(events); -export const removeListener: typeof events['removeListener'] = events.removeListener.bind( - events, -); -export const removeAllListeners: typeof events['removeAllListeners'] = events.removeAllListeners.bind( - events, -); +export const removeListener: typeof events['removeListener'] = + events.removeListener.bind(events); +export const removeAllListeners: typeof events['removeAllListeners'] = + events.removeAllListeners.bind(events); // Whether a container has died, indexed by ID const containerHasDied: Dictionary = {}; @@ -90,10 +88,8 @@ async function get(service: Service) { const containerIds = await getContainerIdMap( service.appUuid || service.appId, ); - const services = ( - await getAll(`service-name=${service.serviceName}`) - ).filter((currentService) => - currentService.isEqualConfig(service, containerIds), + const services = (await getAll(`service-name=${service.serviceName}`)).filter( + (currentService) => currentService.isEqualConfig(service, containerIds), ); if (services.length === 0) { diff --git a/src/compose/service.ts b/src/compose/service.ts index ce30ff44..7072a1a6 100644 --- a/src/compose/service.ts +++ b/src/compose/service.ts @@ -92,9 +92,8 @@ export class Service { 'dns', 'dnsSearch', ]; - public static allConfigArrayFields: ServiceConfigArrayField[] = Service.configArrayFields.concat( - Service.orderedConfigArrayFields, - ); + public static allConfigArrayFields: ServiceConfigArrayField[] = + Service.configArrayFields.concat(Service.orderedConfigArrayFields); // A list of fields to ignore when comparing container configuration private static omitFields = [ @@ -724,9 +723,8 @@ export class Service { ExposedPorts: exposedPorts, Image: this.config.image, Labels: this.config.labels, - NetworkingConfig: ComposeUtils.serviceNetworksToDockerNetworks( - mainNetwork, - ), + NetworkingConfig: + ComposeUtils.serviceNetworksToDockerNetworks(mainNetwork), StopSignal: this.config.stopSignal, Domainname: this.config.domainname, Hostname: this.config.hostname, @@ -821,8 +819,8 @@ export class Service { // Service.orderedConfigArrayFields are defined as // fields inside of Service.config const arrayEq = ComposeUtils.compareArrayFields( - (this.config as unknown) as Dictionary, - (service.config as unknown) as Dictionary, + this.config as unknown as Dictionary, + service.config as unknown as Dictionary, Service.configArrayFields, Service.orderedConfigArrayFields, ); diff --git a/src/compose/utils.ts b/src/compose/utils.ts index ab3972b1..f8e968c2 100644 --- a/src/compose/utils.ts +++ b/src/compose/utils.ts @@ -249,9 +249,8 @@ export function getHealthcheck( const imageServiceHealthcheck = dockerHealthcheckToServiceHealthcheck( _.get(imageInfo, 'Config.Healthcheck', null), ); - const composeServiceHealthcheck = composeHealthcheckToServiceHealthcheck( - composeHealthcheck, - ); + const composeServiceHealthcheck = + composeHealthcheckToServiceHealthcheck(composeHealthcheck); // Overlay any compose healthcheck fields on the image healthchecks return _.assign( @@ -277,9 +276,8 @@ export function getWorkingDir( workingDir: string | null | undefined, imageInfo?: Dockerode.ImageInspectInfo, ): string { - return (workingDir != null - ? workingDir - : _.get(imageInfo, 'Config.WorkingDir', '') + return ( + workingDir != null ? workingDir : _.get(imageInfo, 'Config.WorkingDir', '') ).replace(/(^.+)\/$/, '$1'); } @@ -448,9 +446,10 @@ export function serviceUlimitsToDockerUlimits( return ret; } -export function serviceRestartToDockerRestartPolicy( - restart: string, -): { Name: string; MaximumRetryCount: number } { +export function serviceRestartToDockerRestartPolicy(restart: string): { + Name: string; + MaximumRetryCount: number; +} { return { Name: restart, MaximumRetryCount: 0, @@ -535,9 +534,9 @@ export function normalizeNullValues(obj: Dictionary): void { }); } -export function normalizeLabels(labels: { +export function normalizeLabels(labels: { [key: string]: string }): { [key: string]: string; -}): { [key: string]: string } { +} { const legacyLabels = _.mapKeys( _.pickBy(labels, (_v, k) => _.startsWith(k, 'io.resin.')), (_v, k) => { diff --git a/src/compose/volume.ts b/src/compose/volume.ts index f98cee01..b9514bad 100644 --- a/src/compose/volume.ts +++ b/src/compose/volume.ts @@ -122,9 +122,10 @@ export class Volume { return `${appId}_${name}`; } - private static deconstructDockerName( - name: string, - ): { name: string; appId: number } { + private static deconstructDockerName(name: string): { + name: string; + appId: number; + } { const match = name.match(/(\d+)_(\S+)/); if (match == null) { throw new InternalInconsistencyError( diff --git a/src/config/backends/extra-uEnv.ts b/src/config/backends/extra-uEnv.ts index 037cd6c3..5f5afae9 100644 --- a/src/config/backends/extra-uEnv.ts +++ b/src/config/backends/extra-uEnv.ts @@ -225,10 +225,8 @@ export class ExtraUEnv extends ConfigBackend { // Reduce ConfigOptions into a Map that joins collections return Object.entries(configs).reduce( (configMap: Map, [configKey, configValue]) => { - const { - key: ENTRY_KEY, - collection: ENTRY_IS_COLLECTION, - } = ExtraUEnv.supportedConfigs[configKey]; + const { key: ENTRY_KEY, collection: ENTRY_IS_COLLECTION } = + ExtraUEnv.supportedConfigs[configKey]; // Check if we have to build the value for the entry if (ENTRY_IS_COLLECTION) { return configMap.set( diff --git a/src/config/backends/odmdata.ts b/src/config/backends/odmdata.ts index cd08a7d5..8c6219f2 100644 --- a/src/config/backends/odmdata.ts +++ b/src/config/backends/odmdata.ts @@ -20,12 +20,9 @@ export class Odmdata extends ConfigBackend { private static supportedConfigs = ['configuration']; private BYTE_OFFSETS = [1659, 5243, 18043]; private CONFIG_BYTES = [ - 0x0 /* Config Option #1 */, - 0x1 /* Config Option #2 */, - 0x6 /* Config Option #3 */, - 0x7 /* Config Option #4 */, - 0x2 /* Config Option #5 */, - 0x3 /* Config Option #6 */, + 0x0 /* Config Option #1 */, 0x1 /* Config Option #2 */, + 0x6 /* Config Option #3 */, 0x7 /* Config Option #4 */, + 0x2 /* Config Option #5 */, 0x3 /* Config Option #6 */, ]; private CONFIG_BUFFER = Buffer.from(this.CONFIG_BYTES); diff --git a/src/config/configJson.ts b/src/config/configJson.ts index a6b747e6..6e24989c 100644 --- a/src/config/configJson.ts +++ b/src/config/configJson.ts @@ -35,9 +35,9 @@ export default class ConfigJsonConfigBackend { readLock('config.json').disposer((release) => release()); } - public async set( - keyVals: { [key in T]: unknown }, - ) { + public async set(keyVals: { + [key in T]: unknown; + }) { await this.init(); await Bluebird.using(this.writeLockConfigJson(), async () => { let changed = false; diff --git a/src/config/index.ts b/src/config/index.ts index fc049b5a..e52c8a56 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -35,9 +35,8 @@ interface ConfigEventTypes { change: ConfigChangeMap; } -export const configJsonBackend: ConfigJsonConfigBackend = new ConfigJsonConfigBackend( - Schema.schema, -); +export const configJsonBackend: ConfigJsonConfigBackend = + new ConfigJsonConfigBackend(Schema.schema); type ConfigEventEmitter = StrictEventEmitter; class ConfigEvents extends (EventEmitter as new () => ConfigEventEmitter) {} @@ -46,9 +45,8 @@ const events = new ConfigEvents(); // Expose methods which make this module act as an EventEmitter export const on: typeof events['on'] = events.on.bind(events); export const once: typeof events['once'] = events.once.bind(events); -export const removeListener: typeof events['removeListener'] = events.removeListener.bind( - events, -); +export const removeListener: typeof events['removeListener'] = + events.removeListener.bind(events); export async function get( key: T, @@ -120,9 +118,9 @@ export async function getMany( trx?: Transaction, ): Promise<{ [key in T]: SchemaReturn }> { const values = await Promise.all(keys.map((k) => get(k, trx))); - return (_.zipObject(keys, values) as unknown) as Promise< - { [key in T]: SchemaReturn } - >; + return _.zipObject(keys, values) as unknown as Promise<{ + [key in T]: SchemaReturn; + }>; } export async function set( diff --git a/src/device-state.ts b/src/device-state.ts index 03a636e2..1ef3292b 100644 --- a/src/device-state.ts +++ b/src/device-state.ts @@ -231,12 +231,10 @@ type DeviceStateEventEmitter = StrictEventEmitter< const events = new EventEmitter() as DeviceStateEventEmitter; export const on: typeof events['on'] = events.on.bind(events); export const once: typeof events['once'] = events.once.bind(events); -export const removeListener: typeof events['removeListener'] = events.removeListener.bind( - events, -); -export const removeAllListeners: typeof events['removeAllListeners'] = events.removeAllListeners.bind( - events, -); +export const removeListener: typeof events['removeListener'] = + events.removeListener.bind(events); +export const removeAllListeners: typeof events['removeAllListeners'] = + events.removeAllListeners.bind(events); type DeviceStateStepTarget = 'reboot' | 'shutdown' | 'noop'; @@ -509,9 +507,10 @@ export async function setTarget(target: TargetState, localSource?: boolean) { export function getTarget({ initial = false, intermediate = false, -}: { initial?: boolean; intermediate?: boolean } = {}): Bluebird< - InstancedDeviceState -> { +}: { + initial?: boolean; + intermediate?: boolean; +} = {}): Bluebird { return usingReadLockTarget(async () => { if (intermediate) { return intermediateTarget!; diff --git a/src/device-state/db-format.ts b/src/device-state/db-format.ts index db390ee0..741c85e7 100644 --- a/src/device-state/db-format.ts +++ b/src/device-state/db-format.ts @@ -53,9 +53,11 @@ export async function setApps( const services = Object.keys(release.services ?? {}).map((serviceName) => { const { id: releaseId } = release; - const { id: serviceId, image_id: imageId, ...service } = release.services[ - serviceName - ]; + const { + id: serviceId, + image_id: imageId, + ...service + } = release.services[serviceName]; return { ...service, @@ -94,53 +96,62 @@ export async function getTargetJson(): Promise { const dbApps = await getDBEntry(); return dbApps - .map(({ source, uuid, releaseId, commit: releaseUuid, ...app }): [ - string, - TargetApp, - ] => { - const services = (JSON.parse(app.services) as DatabaseService[]) - .map(({ serviceName, serviceId, imageId, ...service }): [ - string, - TargetService, - ] => [ - serviceName, - { - id: serviceId, - image_id: imageId, - ..._.omit(service, ['appId', 'appUuid', 'commit', 'releaseId']), - } as TargetService, - ]) - // Map by serviceName - .reduce( - (svcs, [serviceName, s]) => ({ - ...svcs, - [serviceName]: s, - }), - {}, - ); - - const releases = releaseUuid - ? { - [releaseUuid]: { - id: releaseId, - services, - networks: JSON.parse(app.networks), - volumes: JSON.parse(app.volumes), - } as TargetRelease, - } - : {}; - - return [ + .map( + ({ + source, uuid, - { - id: app.appId, - name: app.name, - class: app.class, - is_host: !!app.isHost, - releases, - }, - ]; - }) + releaseId, + commit: releaseUuid, + ...app + }): [string, TargetApp] => { + const services = (JSON.parse(app.services) as DatabaseService[]) + .map( + ({ + serviceName, + serviceId, + imageId, + ...service + }): [string, TargetService] => [ + serviceName, + { + id: serviceId, + image_id: imageId, + ..._.omit(service, ['appId', 'appUuid', 'commit', 'releaseId']), + } as TargetService, + ], + ) + // Map by serviceName + .reduce( + (svcs, [serviceName, s]) => ({ + ...svcs, + [serviceName]: s, + }), + {}, + ); + + const releases = releaseUuid + ? { + [releaseUuid]: { + id: releaseId, + services, + networks: JSON.parse(app.networks), + volumes: JSON.parse(app.volumes), + } as TargetRelease, + } + : {}; + + return [ + uuid, + { + id: app.appId, + name: app.name, + class: app.class, + is_host: !!app.isHost, + releases, + }, + ]; + }, + ) .reduce((apps, [uuid, app]) => ({ ...apps, [uuid]: app }), {}); } diff --git a/src/device-state/target-state.ts b/src/device-state/target-state.ts index f604afad..a1b8b0ef 100644 --- a/src/device-state/target-state.ts +++ b/src/device-state/target-state.ts @@ -24,10 +24,8 @@ interface TargetStateEvents { ) => void; 'target-state-apply': (force: boolean, isFromApi: boolean) => void; } -export const emitter: StrictEventEmitter< - EventEmitter, - TargetStateEvents -> = new EventEmitter(); +export const emitter: StrictEventEmitter = + new EventEmitter(); const lockGetTarget = () => writeLock('getTarget').disposer((release) => release()); @@ -105,17 +103,13 @@ export const update = async ( ): Promise => { await config.initialized(); return Bluebird.using(lockGetTarget(), async () => { - const { - uuid, - apiEndpoint, - apiTimeout, - deviceApiKey, - } = await config.getMany([ - 'uuid', - 'apiEndpoint', - 'apiTimeout', - 'deviceApiKey', - ]); + const { uuid, apiEndpoint, apiTimeout, deviceApiKey } = + await config.getMany([ + 'uuid', + 'apiEndpoint', + 'apiTimeout', + 'deviceApiKey', + ]); if (typeof apiEndpoint !== 'string') { throw new InternalInconsistencyError( @@ -228,10 +222,8 @@ export const startPoll = async (): Promise => { }); // Query and set config values we need to avoid multiple db hits - const { - instantUpdates: updates, - appUpdatePollInterval: interval, - } = await config.getMany(['instantUpdates', 'appUpdatePollInterval']); + const { instantUpdates: updates, appUpdatePollInterval: interval } = + await config.getMany(['instantUpdates', 'appUpdatePollInterval']); instantUpdates = updates; appUpdatePollInterval = interval; } catch { diff --git a/src/event-tracker.ts b/src/event-tracker.ts index 91af59b8..1ee71ff0 100644 --- a/src/event-tracker.ts +++ b/src/event-tracker.ts @@ -32,17 +32,9 @@ export let client: mixpanel.Mixpanel | null = null; export const initialized = _.once(async () => { await config.initialized(); - const { - unmanaged, - mixpanelHost, - mixpanelToken, - uuid, - } = await config.getMany([ - 'unmanaged', - 'mixpanelHost', - 'mixpanelToken', - 'uuid', - ]); + const { unmanaged, mixpanelHost, mixpanelToken, uuid } = await config.getMany( + ['unmanaged', 'mixpanelHost', 'mixpanelToken', 'uuid'], + ); defaultProperties = { distinct_id: uuid, diff --git a/src/lib/api-helper.ts b/src/lib/api-helper.ts index bf0f86f6..352fd733 100644 --- a/src/lib/api-helper.ts +++ b/src/lib/api-helper.ts @@ -128,7 +128,9 @@ export const exchangeKeyAndGetDevice = async ( } // We found the device so we can try to register a working device key for it - const [res] = await (await request.getRequestInstance()) + const [res] = await ( + await request.getRequestInstance() + ) .postAsync(`${opts.apiEndpoint}/api-key/device/${device.id}/device-key`, { json: true, body: { diff --git a/src/lib/api-keys.ts b/src/lib/api-keys.ts index 9d84bbbd..4d774113 100644 --- a/src/lib/api-keys.ts +++ b/src/lib/api-keys.ts @@ -72,7 +72,7 @@ export const isScoped = ( scopes: Scope[], ) => scopes.some((scope) => - scopeChecks[scope.type](resources, (scope as unknown) as any), + scopeChecks[scope.type](resources, scope as unknown as any), ); export type AuthorizedRequest = express.Request & { diff --git a/src/lib/docker-utils.ts b/src/lib/docker-utils.ts index ad4a33c4..66b0fc43 100644 --- a/src/lib/docker-utils.ts +++ b/src/lib/docker-utils.ts @@ -170,10 +170,9 @@ export async function fetchDeltaWithProgress( const url = `${deltaOpts.deltaEndpoint}/api/v${deltaOpts.deltaVersion}/delta?src=${deltaOpts.deltaSource}&dest=${imgDest}`; - const [res, data] = await (await request.getRequestInstance()).getAsync( - url, - opts, - ); + const [res, data] = await ( + await request.getRequestInstance() + ).getAsync(url, opts); if (res.statusCode === 502 || res.statusCode === 504) { throw new DeltaStillProcessingError(); } diff --git a/src/lib/legacy.ts b/src/lib/legacy.ts index bd16d19a..73a1ae8a 100644 --- a/src/lib/legacy.ts +++ b/src/lib/legacy.ts @@ -304,76 +304,74 @@ export async function fromV2TargetApps( return ( ( await Promise.all( - Object.keys(apps).map( - async (id): Promise<[string, TargetApp]> => { - const appId = parseInt(id, 10); - const app = apps[appId]; + Object.keys(apps).map(async (id): Promise<[string, TargetApp]> => { + const appId = parseInt(id, 10); + const app = apps[appId]; - // If local mode or connectivity is not available just use id as uuid - const uuid = local - ? id - : await getUUIDFromAPI(appId).catch(() => { - throw new Error( - 'Cannot migrate from v2 apps.json without Internet connectivity. Please use balenaCLI v13.5.1+ for offline preload support.', - ); - }); + // If local mode or connectivity is not available just use id as uuid + const uuid = local + ? id + : await getUUIDFromAPI(appId).catch(() => { + throw new Error( + 'Cannot migrate from v2 apps.json without Internet connectivity. Please use balenaCLI v13.5.1+ for offline preload support.', + ); + }); - const releases = app.commit - ? { - [app.commit]: { - id: app.releaseId, - services: Object.keys(app.services ?? {}) - .map((serviceId) => { - const { - imageId, - serviceName, + const releases = app.commit + ? { + [app.commit]: { + id: app.releaseId, + services: Object.keys(app.services ?? {}) + .map((serviceId) => { + const { + imageId, + serviceName, + image, + environment, + labels, + running, + serviceId: _serviceId, + contract, + ...composition + } = app.services[serviceId]; + + return [ + serviceName, + { + id: serviceId, + image_id: imageId, image, environment, labels, running, - serviceId: _serviceId, contract, - ...composition - } = app.services[serviceId]; + composition, + }, + ]; + }) + .reduce( + (res, [serviceName, svc]) => ({ + ...res, + [serviceName]: svc, + }), + {}, + ), + volumes: app.volumes ?? {}, + networks: app.networks ?? {}, + }, + } + : {}; - return [ - serviceName, - { - id: serviceId, - image_id: imageId, - image, - environment, - labels, - running, - contract, - composition, - }, - ]; - }) - .reduce( - (res, [serviceName, svc]) => ({ - ...res, - [serviceName]: svc, - }), - {}, - ), - volumes: app.volumes ?? {}, - networks: app.networks ?? {}, - }, - } - : {}; - - return [ - uuid, - { - id: appId, - name: app.name, - class: 'fleet', - releases, - } as TargetApp, - ]; - }, - ), + return [ + uuid, + { + id: appId, + name: app.name, + class: 'fleet', + releases, + } as TargetApp, + ]; + }), ) ) // Key by uuid diff --git a/src/lib/supervisor-console.ts b/src/lib/supervisor-console.ts index 1f7a2a17..e63e1ba8 100644 --- a/src/lib/supervisor-console.ts +++ b/src/lib/supervisor-console.ts @@ -42,7 +42,7 @@ const formatter = winston.format.printf((args) => { )}${message}`; }); -export const winstonLog = (winston.createLogger({ +export const winstonLog = winston.createLogger({ format: winston.format.combine(winston.format.colorize(), formatter), transports: [new winston.transports.Console()], // In the future we can reduce this logging level in @@ -57,7 +57,7 @@ export const winstonLog = (winston.createLogger({ // below, we first cast to unknown so we can do what we // like, and then assign every log level a function (which // is what happens internally in winston) -}) as unknown) as { [key in logLevel]: (message: string) => void }; +}) as unknown as { [key in logLevel]: (message: string) => void }; winston.addColors(colors); diff --git a/src/lib/update-lock.ts b/src/lib/update-lock.ts index 559be231..014bd3a4 100644 --- a/src/lib/update-lock.ts +++ b/src/lib/update-lock.ts @@ -46,11 +46,9 @@ export function abortIfHUPInProgress({ force: boolean | undefined; }): Promise { return Promise.all( - [ - 'rollback-health-breadcrumb', - 'rollback-altboot-breadcrumb', - ].map((filename) => - pathExistsOnHost(path.join(constants.stateMountPoint, filename)), + ['rollback-health-breadcrumb', 'rollback-altboot-breadcrumb'].map( + (filename) => + pathExistsOnHost(path.join(constants.stateMountPoint, filename)), ), ).then((existsArray) => { const anyExists = existsArray.some((exists) => exists); diff --git a/src/logging/monitor.ts b/src/logging/monitor.ts index e13c0fc6..9960320d 100644 --- a/src/logging/monitor.ts +++ b/src/logging/monitor.ts @@ -101,9 +101,8 @@ class LogMonitor { timestamp: Date.now(), writeRequired: false, }; - this.containers[ - containerId - ].timestamp = await this.getContainerSentTimestamp(containerId); + this.containers[containerId].timestamp = + await this.getContainerSentTimestamp(containerId); this.backfill(containerId, this.containers[containerId].timestamp); } } diff --git a/src/network.ts b/src/network.ts index db066567..da9cc199 100644 --- a/src/network.ts +++ b/src/network.ts @@ -116,7 +116,8 @@ export const connectivityCheckEnabled = Bluebird.method( () => isConnectivityCheckEnabled, ); -const IP_REGEX = /^(?:(?:balena|docker|rce|tun)[0-9]+|tun[0-9]+|resin-vpn|lo|resin-dns|supervisor0|balena-redsocks|resin-redsocks|br-[0-9a-f]{12})$/; +const IP_REGEX = + /^(?:(?:balena|docker|rce|tun)[0-9]+|tun[0-9]+|resin-vpn|lo|resin-dns|supervisor0|balena-redsocks|resin-redsocks|br-[0-9a-f]{12})$/; export const shouldReportInterface = (intf: string) => !IP_REGEX.test(intf); diff --git a/src/proxyvisor.js b/src/proxyvisor.js index 00b74d0b..e3ec168f 100644 --- a/src/proxyvisor.js +++ b/src/proxyvisor.js @@ -350,9 +350,8 @@ export class Proxyvisor { constructor() { this.executeStepAction = this.executeStepAction.bind(this); this.getCurrentStates = this.getCurrentStates.bind(this); - this.normaliseDependentAppForDB = this.normaliseDependentAppForDB.bind( - this, - ); + this.normaliseDependentAppForDB = + this.normaliseDependentAppForDB.bind(this); this.setTargetInTransaction = this.setTargetInTransaction.bind(this); this.getTarget = this.getTarget.bind(this); this._getHookStep = this._getHookStep.bind(this); diff --git a/src/types/basic.ts b/src/types/basic.ts index c3f5fc5d..35132eda 100644 --- a/src/types/basic.ts +++ b/src/types/basic.ts @@ -191,7 +191,7 @@ export type DeviceName = t.TypeOf; const restrictedRecord = < K extends t.Mixed, V extends t.Mixed, - R extends { [key in t.TypeOf]: t.TypeOf } + R extends { [key in t.TypeOf]: t.TypeOf }, >( k: K, v: V, diff --git a/test/integration/lib/lockfile.spec.ts b/test/integration/lib/lockfile.spec.ts index 72e89145..265b6646 100644 --- a/test/integration/lib/lockfile.spec.ts +++ b/test/integration/lib/lockfile.spec.ts @@ -174,7 +174,7 @@ describe('lib/lockfile', () => { await expect(lockfile.lock(lockOne)).to.not.be.rejected; await expect(lockfile.lock(lockTwo, NOBODY_UID)).to.not.be.rejected; - // @ts-ignore + // @ts-expect-error process.emit('exit'); // Verify lockfile removal regardless of appId / appUuid diff --git a/test/legacy/02-db.spec.ts b/test/legacy/02-db.spec.ts index 1a2d204d..351da76d 100644 --- a/test/legacy/02-db.spec.ts +++ b/test/legacy/02-db.spec.ts @@ -47,14 +47,14 @@ describe('Database Migrations', () => { }); after(() => { - // @ts-ignore + // @ts-expect-error constants.databasePath = process.env.DATABASE_PATH; delete require.cache[require.resolve('~/src/db')]; }); it('creates a database at the path passed on creation', async () => { const databasePath = process.env.DATABASE_PATH_2!; - // @ts-ignore + // @ts-expect-error constants.databasePath = databasePath; delete require.cache[require.resolve('~/src/db')]; @@ -67,7 +67,7 @@ describe('Database Migrations', () => { const databasePath = process.env.DATABASE_PATH_3!; const knexForDB = await createOldDatabase(databasePath); - // @ts-ignore + // @ts-expect-error constants.databasePath = databasePath; delete require.cache[require.resolve('~/src/db')]; const testDb = await import('~/src/db'); diff --git a/test/legacy/08-event-tracker.spec.ts b/test/legacy/08-event-tracker.spec.ts index 94d2a368..902719df 100644 --- a/test/legacy/08-event-tracker.spec.ts +++ b/test/legacy/08-event-tracker.spec.ts @@ -91,9 +91,9 @@ describe('EventTracker', () => { it('initializes a mixpanel client when not in unmanaged mode', () => { expect(eventTracker.initialized()).to.be.fulfilled.then(() => { expect(mixpanel.init).to.have.been.calledWith('someToken'); - // @ts-ignore + // @ts-expect-error expect(eventTracker.client.token).to.equal('someToken'); - // @ts-ignore + // @ts-expect-error expect(eventTracker.client.track).to.be.a('function'); }); }); @@ -138,7 +138,7 @@ describe('EventTracker', () => { 'Test event 2', JSON.stringify({ appId: 'someOtherValue' }), ); - // @ts-ignore + // @ts-expect-error expect(eventTracker.client.track).to.be.calledWith('Test event 2', { appId: 'someOtherValue', uuid: 'barbaz', @@ -150,7 +150,7 @@ describe('EventTracker', () => { it('can be passed an Error and it is added to the event properties', async () => { const theError = new Error('something went wrong'); await eventTracker.track('Error event', theError); - // @ts-ignore + // @ts-expect-error expect(eventTracker.client.track).to.be.calledWith('Error event', { error: { message: theError.message, @@ -174,7 +174,7 @@ describe('EventTracker', () => { }, }; await eventTracker.track('Some app event', props); - // @ts-ignore + // @ts-expect-error expect(eventTracker.client.track).to.be.calledWith('Some app event', { service: { appId: '1' }, uuid: 'barbaz', diff --git a/test/legacy/09-network.spec.ts b/test/legacy/09-network.spec.ts index 4b5fe5c1..8a859cc7 100644 --- a/test/legacy/09-network.spec.ts +++ b/test/legacy/09-network.spec.ts @@ -83,7 +83,7 @@ describe('network', () => { } as any), ); - // @ts-ignore + // @ts-expect-error after(() => os.networkInterfaces.restore()); it('returns only the relevant IP addresses', () => diff --git a/test/legacy/10-api-binder.spec.ts b/test/legacy/10-api-binder.spec.ts index 5383f172..009052b5 100644 --- a/test/legacy/10-api-binder.spec.ts +++ b/test/legacy/10-api-binder.spec.ts @@ -418,9 +418,7 @@ describe('ApiBinder', () => { // Copy previous values to restore later const previousStateReportErrors = currentState.stateReportErrors; - const previousDeviceStateConnected = - // @ts-ignore - components.deviceState.connected; + const previousDeviceStateConnected = components.deviceState.connected; // Set additional conditions not in configStub to cause a fail try { diff --git a/test/legacy/11-logger.spec.ts b/test/legacy/11-logger.spec.ts index d0cff4f6..a9e32eea 100644 --- a/test/legacy/11-logger.spec.ts +++ b/test/legacy/11-logger.spec.ts @@ -25,7 +25,7 @@ describe('Logger', function () { this.requestStub = sinon.stub(https, 'request').returns(this._req); configStub = sinon.stub(config, 'getMany').returns( - // @ts-ignore this should actually work but the type system doesnt like it + // @ts-expect-error this should actually work but the type system doesnt like it Promise.resolve({ apiEndpoint: 'https://example.com', uuid: 'deadbeef', @@ -134,7 +134,7 @@ describe('Logger', function () { '\u0001\u0000\u0000\u0000\u0000\u0000\u0000?2018-09-21T12:37:09.819134000Z this is the message'; const buffer = Buffer.from(message); - // @ts-ignore accessing a private function + // @ts-expect-error accessing a private function expect(ContainerLogs.extractMessage(buffer)).to.deep.equal({ message: 'this is the message', timestamp: 1537533429819, diff --git a/test/legacy/12-device-config.spec.ts b/test/legacy/12-device-config.spec.ts index 101bc004..87ccfc7f 100644 --- a/test/legacy/12-device-config.spec.ts +++ b/test/legacy/12-device-config.spec.ts @@ -158,7 +158,6 @@ describe('device-config', () => { it('correctly parses a config.txt file', async () => { // Will try to parse /test/data/mnt/boot/config.txt await expect( - // @ts-ignore accessing private value deviceConfig.getBootConfig(configTxtBackend), ).to.eventually.deep.equal({ HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"', @@ -181,7 +180,6 @@ describe('device-config', () => { ); await expect( - // @ts-ignore accessing private value deviceConfig.getBootConfig(configTxtBackend), ).to.eventually.deep.equal({ HOST_CONFIG_initramfs: 'initramf.gz 0x00800000', @@ -207,7 +205,7 @@ describe('device-config', () => { }; expect(() => - // @ts-ignore accessing private value + // @ts-expect-error accessing private value deviceConfig.bootConfigChangeRequired( configTxtBackend, current, @@ -243,7 +241,7 @@ describe('device-config', () => { }; expect( - // @ts-ignore accessing private value + // @ts-expect-error accessing private value deviceConfig.bootConfigChangeRequired( configTxtBackend, current, @@ -311,7 +309,7 @@ describe('device-config', () => { }; expect( - // @ts-ignore accessing private value + // @ts-expect-error accessing private value deviceConfig.bootConfigChangeRequired( configTxtBackend, current, @@ -386,11 +384,10 @@ describe('device-config', () => { }; expect( - // @ts-ignore accessing private value + // @ts-expect-error accessing private value deviceConfig.bootConfigChangeRequired(extlinuxBackend, current, target), ).to.equal(true); - // @ts-ignore accessing private value await deviceConfig.setBootConfig(extlinuxBackend, target); expect(logSpy).to.be.calledTwice; expect(logSpy.getCall(1).args[2]).to.equal('Apply boot config success'); diff --git a/test/legacy/14-conversions.spec.ts b/test/legacy/14-conversions.spec.ts index a69941fa..c55e5012 100644 --- a/test/legacy/14-conversions.spec.ts +++ b/test/legacy/14-conversions.spec.ts @@ -30,12 +30,12 @@ describe('conversions', function () { })); it('should return an empty object with an empty input', function () { - // @ts-ignore passing invalid value to test + // @ts-expect-error passing invalid value to test expect(conversion.envArrayToObject(null)).to.deep.equal({}); - // @ts-ignore passing invalid value to test + // @ts-expect-error passing invalid value to test expect(conversion.envArrayToObject('')).to.deep.equal({}); expect(conversion.envArrayToObject([])).to.deep.equal({}); - // @ts-ignore passing invalid value to test + // @ts-expect-error passing invalid value to test expect(conversion.envArrayToObject(1)).to.deep.equal({}); }); }); diff --git a/test/legacy/15-ports.spec.ts b/test/legacy/15-ports.spec.ts index f9d67d79..2b6a2ee5 100644 --- a/test/legacy/15-ports.spec.ts +++ b/test/legacy/15-ports.spec.ts @@ -2,7 +2,7 @@ import { PortMap, PortRange } from '~/src/compose/ports'; import { expect } from 'chai'; // Force cast `PortMap` as a public version so we can test it -const PortMapPublic = (PortMap as any) as new ( +const PortMapPublic = PortMap as any as new ( portStrOrObj: string | PortRange, ) => PortMap; diff --git a/test/legacy/21-supervisor-api.spec.ts b/test/legacy/21-supervisor-api.spec.ts index 5f48f3e2..340af82a 100644 --- a/test/legacy/21-supervisor-api.spec.ts +++ b/test/legacy/21-supervisor-api.spec.ts @@ -178,9 +178,9 @@ describe('SupervisorAPI', () => { }); after(async () => { - // @ts-ignore + // @ts-expect-error Log.info.restore(); - // @ts-ignore + // @ts-expect-error Log.error.restore(); // Resume API for other test suites return api.listen(mockedOptions.listenPort, mockedOptions.timeout); @@ -190,7 +190,7 @@ describe('SupervisorAPI', () => { // Start API await api.listen(mockedOptions.listenPort, mockedOptions.timeout); // Check if success start was logged - // @ts-ignore + // @ts-expect-error expect(Log.info.lastCall?.lastArg).to.equal( `Supervisor API successfully started on port ${mockedOptions.listenPort}`, ); @@ -202,7 +202,7 @@ describe('SupervisorAPI', () => { // Stop API await api.stop(); // Check if stopped with info was logged - // @ts-ignore + // @ts-expect-error expect(Log.info.lastCall?.lastArg).to.equal('Stopped Supervisor API'); }); @@ -212,7 +212,7 @@ describe('SupervisorAPI', () => { // Stop API with error await api.stop({ errored: true }); // Check if stopped with error was logged - // @ts-ignore + // @ts-expect-error expect(Log.error.lastCall?.lastArg).to.equal('Stopped Supervisor API'); }); }); diff --git a/test/legacy/22-local-mode.spec.ts b/test/legacy/22-local-mode.spec.ts index e146ac65..dda41d33 100644 --- a/test/legacy/22-local-mode.spec.ts +++ b/test/legacy/22-local-mode.spec.ts @@ -166,9 +166,8 @@ describe('LocalModeManager', () => { const stubEngineObjectMethods = ( removeThrows: boolean, ): Array> => { - const resArray: Array> = []; + const resArray: Array> = + []; const stub = ( c: sinon.StubbableType, @@ -186,7 +185,7 @@ describe('LocalModeManager', () => { } resArray.push(res); - return (res as unknown) as T; + return res as unknown as T; }; dockerStub.getImage.returns(stub(Docker.Image, 'image')); dockerStub.getContainer.returns(stub(Docker.Container, 'container')); diff --git a/test/legacy/23-contracts.spec.ts b/test/legacy/23-contracts.spec.ts index 9e9cf7ef..e11439d4 100644 --- a/test/legacy/23-contracts.spec.ts +++ b/test/legacy/23-contracts.spec.ts @@ -341,57 +341,51 @@ describe('Container contracts', () => { describe('Optional containers', () => { it('should correctly run passing optional containers', async () => { - const { - valid, - unmetServices, - fulfilledServices, - } = containerContractsFulfilled({ - service1: { - contract: { - type: 'sw.container', - slug: 'service1', - requires: [ - { - type: 'sw.supervisor', - version: `<${supervisorVersionGreater}`, - }, - ], + const { valid, unmetServices, fulfilledServices } = + containerContractsFulfilled({ + service1: { + contract: { + type: 'sw.container', + slug: 'service1', + requires: [ + { + type: 'sw.supervisor', + version: `<${supervisorVersionGreater}`, + }, + ], + }, + optional: true, }, - optional: true, - }, - }); + }); expect(valid).to.equal(true); expect(unmetServices).to.deep.equal([]); expect(fulfilledServices).to.deep.equal(['service1']); }); it('should corrrectly omit failing optional containers', async () => { - const { - valid, - unmetServices, - fulfilledServices, - } = containerContractsFulfilled({ - service1: { - contract: { - type: 'sw.container', - slug: 'service1', - requires: [ - { - type: 'sw.supervisor', - version: `>${supervisorVersionGreater}`, - }, - ], + const { valid, unmetServices, fulfilledServices } = + containerContractsFulfilled({ + service1: { + contract: { + type: 'sw.container', + slug: 'service1', + requires: [ + { + type: 'sw.supervisor', + version: `>${supervisorVersionGreater}`, + }, + ], + }, + optional: true, }, - optional: true, - }, - service2: { - contract: { - type: 'sw.container', - slug: 'service2', + service2: { + contract: { + type: 'sw.container', + slug: 'service2', + }, + optional: false, }, - optional: false, - }, - }); + }); expect(valid).to.equal(true); expect(unmetServices).to.deep.equal(['service1']); expect(fulfilledServices).to.deep.equal(['service2']); diff --git a/test/legacy/24-deltas.spec.ts b/test/legacy/24-deltas.spec.ts index 88dd42f6..88e84805 100644 --- a/test/legacy/24-deltas.spec.ts +++ b/test/legacy/24-deltas.spec.ts @@ -8,8 +8,7 @@ describe('Deltas', () => { const imageStub = stub(dockerUtils.docker, 'getImage').returns({ inspect: () => { return Promise.resolve({ - Id: - 'sha256:34ec91fe6e08cb0f867bbc069c5f499d39297eb8e874bb8ce9707537d983bcbc', + Id: 'sha256:34ec91fe6e08cb0f867bbc069c5f499d39297eb8e874bb8ce9707537d983bcbc', RepoTags: [], RepoDigests: [], Parent: '', diff --git a/test/legacy/27-extlinux-config.spec.ts b/test/legacy/27-extlinux-config.spec.ts index 2e6a4162..180aa53e 100644 --- a/test/legacy/27-extlinux-config.spec.ts +++ b/test/legacy/27-extlinux-config.spec.ts @@ -23,7 +23,7 @@ describe('Extlinux Configuration', () => { APPEND \${cbootargs} \${resin_kernel_root} ro rootwait\ `; - // @ts-ignore accessing private method + // @ts-expect-error accessing private method const parsed = Extlinux.parseExtlinuxFile(text); expect(parsed.globals).to.have.property('DEFAULT').that.equals('primary'); expect(parsed.globals).to.have.property('TIMEOUT').that.equals('30'); @@ -60,7 +60,7 @@ describe('Extlinux Configuration', () => { APPEND test4\ `; - // @ts-ignore accessing private method + // @ts-expect-error accessing private method const parsed = Extlinux.parseExtlinuxFile(text); expect(parsed.labels).to.have.property('primary').that.deep.equals({ LINUX: 'test1', @@ -248,12 +248,11 @@ describe('Extlinux Configuration', () => { }); it('normalizes variable value', () => { - [ - { input: { key: 'key', value: 'value' }, output: 'value' }, - ].forEach(({ input, output }) => - expect(backend.processConfigVarValue(input.key, input.value)).to.equal( - output, - ), + [{ input: { key: 'key', value: 'value' }, output: 'value' }].forEach( + ({ input, output }) => + expect(backend.processConfigVarValue(input.key, input.value)).to.equal( + output, + ), ); }); diff --git a/test/legacy/30-fdt-directive.spec.ts b/test/legacy/30-fdt-directive.spec.ts index ff547364..1344f15f 100644 --- a/test/legacy/30-fdt-directive.spec.ts +++ b/test/legacy/30-fdt-directive.spec.ts @@ -6,7 +6,7 @@ describe('FDT directive', () => { it('parses valid FDT value', () => { VALID_VALUES.forEach(({ input, output }) => - // @ts-ignore input with no FDT can still be parsed + // @ts-expect-error input with no FDT can still be parsed expect(directive.parse(input)).to.deep.equal(output), ); }); diff --git a/test/legacy/33-extra-uenv-config.spec.ts b/test/legacy/33-extra-uenv-config.spec.ts index 028e2b31..98408282 100644 --- a/test/legacy/33-extra-uenv-config.spec.ts +++ b/test/legacy/33-extra-uenv-config.spec.ts @@ -24,7 +24,7 @@ describe('extra_uEnv Configuration', () => { custom_fdt_file=mycustom.dtb extra_os_cmdline=isolcpus=3,4 splash console=tty0 `; - // @ts-ignore accessing private method + // @ts-expect-error accessing private method const parsed = ExtraUEnv.parseOptions(fileContents); expect(parsed).to.deep.equal({ fdt: 'mycustom.dtb', @@ -100,10 +100,10 @@ describe('extra_uEnv Configuration', () => { readFileStub.resolves(badConfig.contents); // Expect warning log from the given bad config await backend.getBootConfig(); - // @ts-ignore + // @ts-expect-error expect(Log.warn.lastCall?.lastArg).to.equal(badConfig.reason); } - // @ts-ignore + // @ts-expect-error Log.warn.restore(); }); @@ -144,10 +144,10 @@ describe('extra_uEnv Configuration', () => { stub(fsUtils, 'writeAndSyncFile').resolves(); const logWarningStub = spy(Log, 'warn'); - // @ts-ignore accessing private value + // @ts-expect-error accessing private value const previousSupportedConfigs = ExtraUEnv.supportedConfigs; // Stub isSupportedConfig so we can confirm collections work - // @ts-ignore accessing private value + // @ts-expect-error accessing private value ExtraUEnv.supportedConfigs = { fdt: { key: 'custom_fdt_file', collection: false }, isolcpus: { key: 'extra_os_cmdline', collection: true }, @@ -171,7 +171,7 @@ describe('extra_uEnv Configuration', () => { // Restore stubs (fsUtils.writeAndSyncFile as SinonStub).restore(); logWarningStub.restore(); - // @ts-ignore accessing private value + // @ts-expect-error accessing private value ExtraUEnv.supportedConfigs = previousSupportedConfigs; }); @@ -212,12 +212,11 @@ describe('extra_uEnv Configuration', () => { }); it('normalizes variable value', () => { - [ - { input: { key: 'key', value: 'value' }, output: 'value' }, - ].forEach(({ input, output }) => - expect(backend.processConfigVarValue(input.key, input.value)).to.equal( - output, - ), + [{ input: { key: 'key', value: 'value' }, output: 'value' }].forEach( + ({ input, output }) => + expect(backend.processConfigVarValue(input.key, input.value)).to.equal( + output, + ), ); }); diff --git a/test/legacy/37-odmdata-config.spec.ts b/test/legacy/37-odmdata-config.spec.ts index 27e80a36..522a5e93 100644 --- a/test/legacy/37-odmdata-config.spec.ts +++ b/test/legacy/37-odmdata-config.spec.ts @@ -10,17 +10,17 @@ describe('ODMDATA Configuration', () => { const backend = new Odmdata(); let logWarningStub: SinonStub; let logErrorStub: SinonStub; - // @ts-ignore accessing private vluae + // @ts-expect-error accessing private vluae const previousConfigPath = Odmdata.bootConfigPath; const testConfigPath = resolve(process.cwd(), 'test/data/boot0.img'); before(() => { - // @ts-ignore setting value of private variable + // @ts-expect-error setting value of private variable Odmdata.bootConfigPath = testConfigPath; }); after(() => { - // @ts-ignore setting value of private variable + // @ts-expect-error setting value of private variable Odmdata.bootConfigPath = previousConfigPath; }); @@ -60,7 +60,7 @@ describe('ODMDATA Configuration', () => { // Stub openFileStub with specific error openFileStub.rejects(log.error); try { - // @ts-ignore accessing private value + // @ts-expect-error accessing private value await backend.getFileHandle(testConfigPath); } catch { // noop @@ -80,7 +80,7 @@ describe('ODMDATA Configuration', () => { it('correctly parses configuration mode', async () => { for (const config of CONFIG_MODES) { - // @ts-ignore accessing private value + // @ts-expect-error accessing private value expect(backend.parseOptions(config.buffer)).to.deep.equal({ configuration: config.mode, }); @@ -90,7 +90,7 @@ describe('ODMDATA Configuration', () => { it('logs error for malformed configuration mode', async () => { // Logs when configuration mode is unknown try { - // @ts-ignore accessing private value + // @ts-expect-error accessing private value backend.parseOptions(Buffer.from([0x9, 0x9, 0x9])); } catch (e) { // noop @@ -102,7 +102,7 @@ describe('ODMDATA Configuration', () => { // Logs when bytes don't match try { - // @ts-ignore accessing private value + // @ts-expect-error accessing private value backend.parseOptions(Buffer.from([0x1, 0x0, 0x0])); } catch { // noop @@ -115,7 +115,7 @@ describe('ODMDATA Configuration', () => { it('unlock/lock bootConfigPath RO access', async () => { const writeSpy = stub().resolves(); - // @ts-ignore accessing private value + // @ts-expect-error accessing private value const handleStub = stub(backend, 'getFileHandle').resolves({ write: writeSpy, close: async (): Promise => { @@ -123,11 +123,11 @@ describe('ODMDATA Configuration', () => { }, }); - // @ts-ignore accessing private value + // @ts-expect-error accessing private value await backend.setReadOnly(false); // Try to unlock expect(writeSpy).to.be.calledWith('0'); - // @ts-ignore accessing private value + // @ts-expect-error accessing private value await backend.setReadOnly(true); // Try to lock expect(writeSpy).to.be.calledWith('1'); @@ -135,7 +135,7 @@ describe('ODMDATA Configuration', () => { }); it('sets new config values', async () => { - // @ts-ignore accessing private value + // @ts-expect-error accessing private value const setROStub = stub(backend, 'setReadOnly'); setROStub.resolves(); // Get current config @@ -189,12 +189,11 @@ describe('ODMDATA Configuration', () => { }); it('normalizes variable value', () => { - [ - { input: { key: 'key', value: 'value' }, output: 'value' }, - ].forEach(({ input, output }) => - expect(backend.processConfigVarValue(input.key, input.value)).to.equal( - output, - ), + [{ input: { key: 'key', value: 'value' }, output: 'value' }].forEach( + ({ input, output }) => + expect(backend.processConfigVarValue(input.key, input.value)).to.equal( + output, + ), ); }); diff --git a/test/legacy/41-device-api-v1.spec.ts b/test/legacy/41-device-api-v1.spec.ts index 222168e3..4e789389 100644 --- a/test/legacy/41-device-api-v1.spec.ts +++ b/test/legacy/41-device-api-v1.spec.ts @@ -1065,11 +1065,9 @@ describe('SupervisorAPI [V1 Endpoints]', () => { it('skips restarting hostname services if they are part of config-json.target', async () => { // stub servicePartOf to return the config-json.target we are looking for - stub(dbus, 'servicePartOf').callsFake( - async (): Promise => { - return 'config-json.target'; - }, - ); + stub(dbus, 'servicePartOf').callsFake(async (): Promise => { + return 'config-json.target'; + }); await unlinkAll(redsocksPath, noProxyPath); @@ -1223,11 +1221,9 @@ describe('SupervisorAPI [V1 Endpoints]', () => { it('skips restarting proxy services when part of redsocks-conf.target', async () => { // stub servicePartOf to return the redsocks-conf.target we are looking for - stub(dbus, 'servicePartOf').callsFake( - async (): Promise => { - return 'redsocks-conf.target'; - }, - ); + stub(dbus, 'servicePartOf').callsFake(async (): Promise => { + return 'redsocks-conf.target'; + }); // Test each proxy patch sequentially to prevent conflicts when writing to fs for (const key of Object.keys(validProxyReqs)) { const patchBodyValuesforKey: string[] | number[] = diff --git a/test/legacy/src/compose/app.spec.ts b/test/legacy/src/compose/app.spec.ts index 7573d9f7..d592f665 100644 --- a/test/legacy/src/compose/app.spec.ts +++ b/test/legacy/src/compose/app.spec.ts @@ -396,10 +396,11 @@ describe('compose/app', () => { volumes: [volume], isTarget: true, }); - const recreateVolumeSteps = currentWithVolumesRemoved.nextStepsForAppUpdate( - contextWithImages, - target, - ); + const recreateVolumeSteps = + currentWithVolumesRemoved.nextStepsForAppUpdate( + contextWithImages, + target, + ); expect(recreateVolumeSteps).to.have.length(1); expectSteps('createVolume', recreateVolumeSteps); @@ -411,10 +412,11 @@ describe('compose/app', () => { volumes: [volume], }); - const createServiceSteps = currentWithVolumeRecreated.nextStepsForAppUpdate( - contextWithImages, - target, - ); + const createServiceSteps = + currentWithVolumeRecreated.nextStepsForAppUpdate( + contextWithImages, + target, + ); expectSteps('start', createServiceSteps); }); }); diff --git a/test/legacy/src/compose/application-manager.spec.ts b/test/legacy/src/compose/application-manager.spec.ts index 1f6e2238..2f185b7d 100644 --- a/test/legacy/src/compose/application-manager.spec.ts +++ b/test/legacy/src/compose/application-manager.spec.ts @@ -216,15 +216,11 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService({ running: false, appId: 1 })], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [await createService({ running: false, appId: 1 })], + networks: [DEFAULT_NETWORK], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -248,15 +244,11 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService()], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [await createService()], + networks: [DEFAULT_NETWORK], + }); const [killStep] = await applicationManager.inferNextSteps( currentApps, @@ -282,16 +274,12 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService({ appId: 1 })], - networks: [DEFAULT_NETWORK], - images: [], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [await createService({ appId: 1 })], + networks: [DEFAULT_NETWORK], + images: [], + }); const [fetchStep] = await applicationManager.inferNextSteps( currentApps, @@ -317,16 +305,12 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService({ appId: 1 })], - networks: [DEFAULT_NETWORK], - downloading: ['image-new'], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [await createService({ appId: 1 })], + networks: [DEFAULT_NETWORK], + downloading: ['image-new'], + }); const [noopStep, ...nextSteps] = await applicationManager.inferNextSteps( currentApps, @@ -360,25 +344,21 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService( - { - image: 'image-old', - labels, - appId: 1, - commit: 'old-release', - }, - { options: { imageInfo: { Id: 'sha256:image-old-id' } } }, - ), - ], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService( + { + image: 'image-old', + labels, + appId: 1, + commit: 'old-release', + }, + { options: { imageInfo: { Id: 'sha256:image-old-id' } } }, + ), + ], + networks: [DEFAULT_NETWORK], + }); const [killStep] = await applicationManager.inferNextSteps( currentApps, @@ -414,25 +394,21 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService( - { - image: 'image-old', - labels, - appId: 1, - commit: 'old-release', - }, - { options: { imageInfo: { Id: 'sha256:image-old-id' } } }, - ), - ], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService( + { + image: 'image-old', + labels, + appId: 1, + commit: 'old-release', + }, + { options: { imageInfo: { Id: 'sha256:image-old-id' } } }, + ), + ], + networks: [DEFAULT_NETWORK], + }); const [killStep] = await applicationManager.inferNextSteps( currentApps, @@ -468,23 +444,19 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - images: [ - createImage({ - appId: 1, - name: 'image-old', - serviceName: 'main', - dockerImageId: 'image-old-id', - }), - ], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + images: [ + createImage({ + appId: 1, + name: 'image-old', + serviceName: 'main', + dockerImageId: 'image-old-id', + }), + ], + networks: [DEFAULT_NETWORK], + }); const [removeImage] = await applicationManager.inferNextSteps( currentApps, @@ -527,38 +499,34 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService({ - appId: 1, - commit: 'old-release', - serviceName: 'main', - composition: { - depends_on: ['dep'], - }, - }), - await createService({ - appId: 1, - commit: 'old-release', - serviceName: 'dep', - }), - ], - networks: [DEFAULT_NETWORK], - downloading: ['dep-image'], // dep-image is still being downloaded - images: [ - // main-image was already downloaded - createImage({ - appId: 1, - name: 'main-image', - serviceName: 'main', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService({ + appId: 1, + commit: 'old-release', + serviceName: 'main', + composition: { + depends_on: ['dep'], + }, + }), + await createService({ + appId: 1, + commit: 'old-release', + serviceName: 'dep', + }), + ], + networks: [DEFAULT_NETWORK], + downloading: ['dep-image'], // dep-image is still being downloaded + images: [ + // main-image was already downloaded + createImage({ + appId: 1, + name: 'main-image', + serviceName: 'main', + }), + ], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -601,48 +569,44 @@ describe('compose/application-manager', () => { true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService({ - appId: 1, - appUuid: 'appuuid', - commit: 'old-release', - serviceName: 'main', - composition: { - depends_on: ['dep'], - }, - }), - await createService({ - appId: 1, - appUuid: 'appuuid', - commit: 'old-release', - serviceName: 'dep', - }), - ], - networks: [DEFAULT_NETWORK], - images: [ - // Both images have been downloaded - createImage({ - appId: 1, - appUuid: 'appuuid', - name: 'main-image', - serviceName: 'main', - commit: 'new-release', - }), - createImage({ - appId: 1, - appUuid: 'appuuid', - name: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService({ + appId: 1, + appUuid: 'appuuid', + commit: 'old-release', + serviceName: 'main', + composition: { + depends_on: ['dep'], + }, + }), + await createService({ + appId: 1, + appUuid: 'appuuid', + commit: 'old-release', + serviceName: 'dep', + }), + ], + networks: [DEFAULT_NETWORK], + images: [ + // Both images have been downloaded + createImage({ + appId: 1, + appUuid: 'appuuid', + name: 'main-image', + serviceName: 'main', + commit: 'new-release', + }), + createImage({ + appId: 1, + appUuid: 'appuuid', + name: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }), + ], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -690,28 +654,24 @@ describe('compose/application-manager', () => { true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [DEFAULT_NETWORK], - images: [ - // Both images have been downloaded - createImage({ - name: 'main-image', - serviceName: 'main', - commit: 'new-release', - }), - createImage({ - name: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [DEFAULT_NETWORK], + images: [ + // Both images have been downloaded + createImage({ + name: 'main-image', + serviceName: 'main', + commit: 'new-release', + }), + createImage({ + name: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }), + ], + }); const [startStep, ...nextSteps] = await applicationManager.inferNextSteps( currentApps, @@ -756,34 +716,30 @@ describe('compose/application-manager', () => { true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService({ - image: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), - ], - networks: [DEFAULT_NETWORK], - images: [ - // Both images have been downloaded - createImage({ - name: 'main-image', - serviceName: 'main', - commit: 'new-release', - }), - createImage({ - name: 'dep-image', - serviceName: 'dep', - commit: 'new-release', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService({ + image: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }), + ], + networks: [DEFAULT_NETWORK], + images: [ + // Both images have been downloaded + createImage({ + name: 'main-image', + serviceName: 'main', + commit: 'new-release', + }), + createImage({ + name: 'dep-image', + serviceName: 'dep', + commit: 'new-release', + }), + ], + }); const [startStep, ...nextSteps] = await applicationManager.inferNextSteps( currentApps, @@ -812,22 +768,20 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService({ appId: 5, serviceName: 'old-service' })], - networks: [DEFAULT_NETWORK], - images: [ - // Image has been downloaded - createImage({ - name: 'main-image', - serviceName: 'main', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService({ appId: 5, serviceName: 'old-service' }), + ], + networks: [DEFAULT_NETWORK], + images: [ + // Image has been downloaded + createImage({ + name: 'main-image', + serviceName: 'main', + }), + ], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -857,16 +811,12 @@ describe('compose/application-manager', () => { it('should not remove an app volumes when they are no longer referenced', async () => { const targetApps = createApps({ networks: [DEFAULT_NETWORK] }, true); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [DEFAULT_NETWORK], - volumes: [Volume.fromComposeObject('test-volume', 1, 'deadbeef')], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [DEFAULT_NETWORK], + volumes: [Volume.fromComposeObject('test-volume', 1, 'deadbeef')], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -883,17 +833,13 @@ describe('compose/application-manager', () => { it('should remove volumes from previous applications', async () => { const targetApps = createApps({ networks: [DEFAULT_NETWORK] }, true); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [], - // Volume with different id - volumes: [Volume.fromComposeObject('test-volume', 2, 'deadbeef')], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [], + // Volume with different id + volumes: [Volume.fromComposeObject('test-volume', 2, 'deadbeef')], + }); const steps = await applicationManager.inferNextSteps( currentApps, @@ -916,24 +862,18 @@ describe('compose/application-manager', () => { { services: [await createService()], networks: [DEFAULT_NETWORK] }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [DEFAULT_NETWORK], + }); - const [ - ensureNetworkStep, - ...nextSteps - ] = await applicationManager.inferNextSteps(currentApps, targetApps, { - downloading, - availableImages, - containerIdsByAppId, - }); + const [ensureNetworkStep, ...nextSteps] = + await applicationManager.inferNextSteps(currentApps, targetApps, { + downloading, + availableImages, + containerIdsByAppId, + }); expect(ensureNetworkStep).to.deep.include({ action: 'ensureSupervisorNetwork', }); @@ -955,17 +895,13 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService({ labels }, { options: { listenPort: '48484' } }), - ], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService({ labels }, { options: { listenPort: '48484' } }), + ], + networks: [DEFAULT_NETWORK], + }); const [killStep] = await applicationManager.inferNextSteps( currentApps, @@ -995,15 +931,11 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [await createService()], - networks: [DEFAULT_NETWORK], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [await createService()], + networks: [DEFAULT_NETWORK], + }); const [cleanupStep, ...nextSteps] = await applicationManager.inferNextSteps( currentApps, @@ -1036,30 +968,26 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [DEFAULT_NETWORK], - images: [ - // An image for a service that no longer exists - createImage({ - name: 'old-image', - appId: 5, - serviceName: 'old-service', - dockerImageId: 'sha256:aaaa', - }), - createImage({ - name: 'main-image', - appId: 1, - serviceName: 'main', - dockerImageId: 'sha256:bbbb', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [DEFAULT_NETWORK], + images: [ + // An image for a service that no longer exists + createImage({ + name: 'old-image', + appId: 5, + serviceName: 'old-service', + dockerImageId: 'sha256:aaaa', + }), + createImage({ + name: 'main-image', + appId: 1, + serviceName: 'main', + dockerImageId: 'sha256:bbbb', + }), + ], + }); const [removeImageStep] = await applicationManager.inferNextSteps( currentApps, @@ -1088,36 +1016,32 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [ - await createService( - { image: 'main-image' }, - // Target has a matching image already - { options: { imageInfo: { Id: 'sha256:bbbb' } } }, - ), - ], - networks: [DEFAULT_NETWORK], - images: [ - // An image for a service that no longer exists - createImage({ - name: 'old-image', - appId: 5, - serviceName: 'old-service', - dockerImageId: 'sha256:aaaa', - }), - createImage({ - name: 'main-image', - appId: 1, - serviceName: 'main', - dockerImageId: 'sha256:bbbb', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [ + await createService( + { image: 'main-image' }, + // Target has a matching image already + { options: { imageInfo: { Id: 'sha256:bbbb' } } }, + ), + ], + networks: [DEFAULT_NETWORK], + images: [ + // An image for a service that no longer exists + createImage({ + name: 'old-image', + appId: 5, + serviceName: 'old-service', + dockerImageId: 'sha256:aaaa', + }), + createImage({ + name: 'main-image', + appId: 1, + serviceName: 'main', + dockerImageId: 'sha256:bbbb', + }), + ], + }); const [removeImageStep] = await applicationManager.inferNextSteps( currentApps, @@ -1152,16 +1076,12 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [DEFAULT_NETWORK], - images: [], // no available images exist - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [DEFAULT_NETWORK], + images: [], // no available images exist + }); const [saveImageStep] = await applicationManager.inferNextSteps( currentApps, @@ -1207,35 +1127,31 @@ describe('compose/application-manager', () => { }, true, ); - const { - currentApps, - availableImages, - downloading, - containerIdsByAppId, - } = createCurrentState({ - services: [], - networks: [ - // Default networks for two apps - Network.fromComposeObject('default', 1, 'app-one', {}), - Network.fromComposeObject('default', 2, 'app-two', {}), - ], - images: [ - createImage({ - name: 'main-image-1', - appId: 1, - appUuid: 'app-one', - serviceName: 'main', - commit: 'commit-for-app-1', - }), - createImage({ - name: 'main-image-2', - appId: 2, - appUuid: 'app-two', - serviceName: 'main', - commit: 'commit-for-app-2', - }), - ], - }); + const { currentApps, availableImages, downloading, containerIdsByAppId } = + createCurrentState({ + services: [], + networks: [ + // Default networks for two apps + Network.fromComposeObject('default', 1, 'app-one', {}), + Network.fromComposeObject('default', 2, 'app-two', {}), + ], + images: [ + createImage({ + name: 'main-image-1', + appId: 1, + appUuid: 'app-one', + serviceName: 'main', + commit: 'commit-for-app-1', + }), + createImage({ + name: 'main-image-2', + appId: 2, + appUuid: 'app-two', + serviceName: 'main', + commit: 'commit-for-app-2', + }), + ], + }); const steps = await applicationManager.inferNextSteps( currentApps, diff --git a/test/legacy/src/compose/images.spec.ts b/test/legacy/src/compose/images.spec.ts index 16e62bbf..1ea43926 100644 --- a/test/legacy/src/compose/images.spec.ts +++ b/test/legacy/src/compose/images.spec.ts @@ -57,8 +57,7 @@ describe('compose/images', () => { it('finds image by matching digest on the database', async () => { const dbImage = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/aaaaa@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/aaaaa@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', dockerImageId: 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', }); @@ -67,8 +66,7 @@ describe('compose/images', () => { const images = [ createImage( { - Id: - 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', + Id: 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', }, { References: [ @@ -108,8 +106,7 @@ describe('compose/images', () => { const images = [ createImage( { - Id: - 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', + Id: 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', }, { References: ['some-image:some-tag'], @@ -149,8 +146,7 @@ describe('compose/images', () => { const images = [ createImage( { - Id: - 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', + Id: 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', }, { References: [ @@ -186,8 +182,7 @@ describe('compose/images', () => { const images = [ createImage( { - Id: - 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', + Id: 'sha256:f1154d76c731f04711e5856b6e6858730e3023d9113124900ac65c2ccc90e8e7', }, { References: [ @@ -262,8 +257,7 @@ describe('compose/images', () => { dockerImageId: 'sha256:second-image-id', }), createDBImage({ - name: - 'registry2.balena-cloud.com/v2/three@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf558', + name: 'registry2.balena-cloud.com/v2/three@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf558', serviceName: 'app_3', // Third image has different name but same docker id dockerImageId: 'sha256:second-image-id', @@ -381,8 +375,7 @@ describe('compose/images', () => { it('removes image from DB and engine when there is a single DB image with matching name', async () => { // Newer image const imageToRemove = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', dockerImageId: 'sha256:image-id-one', }); @@ -390,8 +383,7 @@ describe('compose/images', () => { await testDb.models('image').insert([ imageToRemove, createDBImage({ - name: - 'registry2.balena-cloud.com/v2/two@sha256:12345a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/two@sha256:12345a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', dockerImageId: 'sha256:image-id-two', }), ]); @@ -469,14 +461,12 @@ describe('compose/images', () => { it('removes the requested image even when there are multiple DB images with same docker ID', async () => { const imageToRemove = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', dockerImageId: 'sha256:image-id-one', }); const imageWithSameDockerImageId = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/two@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/two@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', // Same imageId dockerImageId: 'sha256:image-id-one', }); @@ -554,14 +544,12 @@ describe('compose/images', () => { it('removes image from DB by tag when deltas are being used', async () => { const imageToRemove = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/one@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', dockerImageId: 'sha256:image-one-id', }); const imageWithSameDockerImageId = createDBImage({ - name: - 'registry2.balena-cloud.com/v2/two@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', + name: 'registry2.balena-cloud.com/v2/two@sha256:2c969a1ba1c6bc10df53481f48c6a74dbd562cfb41ba58f81beabd03facf5582', // Same docker id dockerImageId: 'sha256:image-one-id', }); diff --git a/test/legacy/src/lib/update-lock.spec.ts b/test/legacy/src/lib/update-lock.spec.ts index 6a8af8ff..07078808 100644 --- a/test/legacy/src/lib/update-lock.spec.ts +++ b/test/legacy/src/lib/update-lock.spec.ts @@ -40,12 +40,12 @@ describe('lib/update-lock', () => { // TODO: Remove these hooks when we don't need './test/data' as test process's rootMountPoint before(() => { - // @ts-ignore // Set rootMountPoint for mockFs + // @ts-expect-error // Set rootMountPoint for mockFs constants.rootMountPoint = '/mnt/root'; }); after(() => { - // @ts-ignore + // @ts-expect-error constants.rootMountPoint = process.env.ROOT_MOUNTPOINT; }); @@ -125,7 +125,7 @@ describe('lib/update-lock', () => { lockSpy = spy(lockfile, 'lock'); // lockfile.lock calls exec to interface with the lockfile binary, // so mock it here as we don't have access to the binary in the test env - // @ts-ignore + // @ts-expect-error execStub = stub(fsUtils, 'exec').callsFake(async (command, opts) => { // Sanity check for the command call expect(command.trim().startsWith('lockfile')).to.be.true; diff --git a/test/lib/db-helper.ts b/test/lib/db-helper.ts index caa7e365..7ad52917 100644 --- a/test/lib/db-helper.ts +++ b/test/lib/db-helper.ts @@ -9,7 +9,7 @@ export async function createDB() { // for testing we use an in memory database process.env.DATABASE_PATH = ':memory:'; - // @ts-ignore + // @ts-expect-error constants.databasePath = process.env.DATABASE_PATH; // Cleanup the module cache in order to have it reloaded in the local context @@ -71,7 +71,7 @@ export async function createDB() { (db.upsertModel as sinon.SinonStub).restore(); // Restore the constants - // @ts-ignore + // @ts-expect-error constants.databasePath = process.env.DATABASE_PATH; // Cleanup the module cache in order to have it reloaded diff --git a/test/lib/mocked-database.ts b/test/lib/mocked-database.ts index f5d694e5..d1e498fe 100644 --- a/test/lib/mocked-database.ts +++ b/test/lib/mocked-database.ts @@ -37,7 +37,7 @@ export function setImages(images: Image[]) { function stubImages() { // Set the functions for this model (add them as you need for your test cases) - MOCKED_MODELS['image'] = ({ + MOCKED_MODELS['image'] = { select: () => { return { where: async (condition: Partial) => @@ -64,5 +64,5 @@ function stubImages() { }, }; }, - } as unknown) as QueryBuilder; + } as unknown as QueryBuilder; } diff --git a/test/lib/mocked-device-api.ts b/test/lib/mocked-device-api.ts index 6ae30cf5..4b5dba08 100644 --- a/test/lib/mocked-device-api.ts +++ b/test/lib/mocked-device-api.ts @@ -94,8 +94,7 @@ const mockService = (overrides?: Partial) => { const mockImage = (overrides?: Partial) => { return { ...{ - name: - 'registry2.balena-cloud.com/v2/e2bf6410ffc30850e96f5071cdd1dca8@sha256:e2e87a8139b8fc14510095b210ad652d7d5badcc64fdc686cbf749d399fba15e', + name: 'registry2.balena-cloud.com/v2/e2bf6410ffc30850e96f5071cdd1dca8@sha256:e2e87a8139b8fc14510095b210ad652d7d5badcc64fdc686cbf749d399fba15e', appId: 1658654, serviceName: 'main', imageId: 2885946, diff --git a/test/lib/mocked-dockerode.ts b/test/lib/mocked-dockerode.ts index 3eda021d..2e661f1e 100644 --- a/test/lib/mocked-dockerode.ts +++ b/test/lib/mocked-dockerode.ts @@ -75,7 +75,7 @@ registerOverride( export function registerOverride< T extends DockerodeFunction, P extends Parameters, - R extends ReturnType + R extends ReturnType, >(name: T, fn: (...args: P) => R) { console.log(`Overriding ${name}...`); overrides[name] = fn; diff --git a/test/lib/mockerode.ts b/test/lib/mockerode.ts index b38ac51d..74f3f4a2 100644 --- a/test/lib/mockerode.ts +++ b/test/lib/mockerode.ts @@ -11,29 +11,25 @@ type DeepPartial = { }; // Partial container inspect info for receiving as testing data -export type PartialContainerInspectInfo = DeepPartial< - dockerode.ContainerInspectInfo -> & { - Id: string; -}; +export type PartialContainerInspectInfo = + DeepPartial & { + Id: string; + }; -export type PartialNetworkInspectInfo = DeepPartial< - dockerode.NetworkInspectInfo -> & { - Id: string; -}; +export type PartialNetworkInspectInfo = + DeepPartial & { + Id: string; + }; -export type PartialVolumeInspectInfo = DeepPartial< - dockerode.VolumeInspectInfo -> & { - Name: string; -}; +export type PartialVolumeInspectInfo = + DeepPartial & { + Name: string; + }; -export type PartialImageInspectInfo = DeepPartial< - dockerode.ImageInspectInfo -> & { - Id: string; -}; +export type PartialImageInspectInfo = + DeepPartial & { + Id: string; + }; type Methods = { [K in keyof T]: T[K] extends (...args: any) => any ? T[K] : never; @@ -320,14 +316,8 @@ export function createImage( const createImageInspectInfo = ( partialImage: PartialImageInspectInfo, ): dockerode.ImageInspectInfo => { - const { - Id, - ContainerConfig, - Config, - GraphDriver, - RootFS, - ...Info - } = partialImage; + const { Id, ContainerConfig, Config, GraphDriver, RootFS, ...Info } = + partialImage; return { Id, @@ -905,9 +895,9 @@ export class MockEngine { } export function createMockerode(engine: MockEngine) { - const dockerodeStubs: Stubs = (Object.getOwnPropertyNames( - dockerode.prototype, - ) as (keyof dockerode)[]) + const dockerodeStubs: Stubs = ( + Object.getOwnPropertyNames(dockerode.prototype) as (keyof dockerode)[] + ) .filter((fn) => typeof dockerode.prototype[fn] === 'function') .reduce((stubMap, fn) => { const stub = sinon.stub(dockerode.prototype, fn); diff --git a/test/unit/lib/fs-utils.spec.ts b/test/unit/lib/fs-utils.spec.ts index 081de9e7..e455dea0 100644 --- a/test/unit/lib/fs-utils.spec.ts +++ b/test/unit/lib/fs-utils.spec.ts @@ -155,9 +155,9 @@ describe('lib/fs-utils', () => { it("should return the paths of one or more files as they exist on host OS's root", async () => { expect(fsUtils.getPathOnHost(testFileName1)).to.deep.equal(testFile1); - expect( - fsUtils.getPathOnHost(testFileName1, testFileName2), - ).to.deep.equal([testFile1, testFile2]); + expect(fsUtils.getPathOnHost(testFileName1, testFileName2)).to.deep.equal( + [testFile1, testFile2], + ); }); }); diff --git a/test/unit/lib/system-info.spec.ts b/test/unit/lib/system-info.spec.ts index ca0d89f0..753d7a2c 100644 --- a/test/unit/lib/system-info.spec.ts +++ b/test/unit/lib/system-info.spec.ts @@ -12,7 +12,6 @@ describe('System information', () => { stub(systeminformation, 'mem').resolves(mockMemory); stub(systeminformation, 'currentLoad').resolves(mockCPU.load); stub(systeminformation, 'cpuTemperature').resolves(mockCPU.temp); - // @ts-ignore TS thinks we can't return a buffer... stub(fs, 'readFile').resolves(mockCPU.idBuffer); stub(fsUtils, 'exec'); });