Update @balena/lint to 8.0.0

Change-type: patch
This commit is contained in:
myarmolinsky 2024-03-14 08:11:53 -04:00
parent 6ebeb97917
commit 634ad156ce
44 changed files with 830 additions and 808 deletions

View File

@ -22,7 +22,7 @@ import * as archiver from 'archiver';
import * as Bluebird from 'bluebird';
import { exec, execFile } from 'child_process';
import * as filehound from 'filehound';
import { Stats } from 'fs';
import type { Stats } from 'fs';
import * as fs from 'fs-extra';
import * as klaw from 'klaw';
import * as path from 'path';

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Command as OclifCommandClass } from '@oclif/core';
import type { Command as OclifCommandClass } from '@oclif/core';
type OclifCommand = typeof OclifCommandClass;

View File

@ -16,7 +16,7 @@
*/
import * as path from 'path';
import { getCapitanoDoc } from './capitanodoc';
import { Category, Document, OclifCommand } from './doc-types';
import type { Category, Document, OclifCommand } from './doc-types';
import * as markdown from './markdown';
import { stripIndent } from '../../lib/utils/lazy';

View File

@ -20,7 +20,7 @@ import * as _ from 'lodash';
import { getManualSortCompareFunction } from '../../lib/utils/helpers';
import { capitanoizeOclifUsage } from '../../lib/utils/oclif-utils';
import { Category, Document, OclifCommand } from './doc-types';
import type { Category, Document, OclifCommand } from './doc-types';
function renderOclifCommand(command: OclifCommand): string[] {
const result = [`## ${ent.encode(command.usage || '')}`];

View File

@ -107,11 +107,11 @@ async function $main() {
const changeType = process.argv[4]
? // if the caller specified a change type, use that one
validateChangeType(process.argv[4])
validateChangeType(process.argv[4])
: // use the same change type as in the dependency, but avoid major bumps
semverChangeType && semverChangeType !== 'major'
? semverChangeType
: 'minor';
semverChangeType && semverChangeType !== 'major'
? semverChangeType
: 'minor';
console.log(`Using Change-type: ${changeType}`);
let { stdout: currentBranch } = await run('git rev-parse --abbrev-ref HEAD');

View File

@ -76,8 +76,8 @@ export function diffLines(str1: string, str2: string): string {
return part.added
? prefix(part.value, '+')
: part.removed
? prefix(part.value, '-')
: prefix(part.value, ' ');
? prefix(part.value, '-')
: prefix(part.value, ' ');
})
.join('\n');
return diffStr;

View File

@ -16,8 +16,8 @@
*/
import * as packageJSON from '../package.json';
import type { AppOptions } from './preparser';
import {
AppOptions,
checkDeletedCommand,
preparseArgs,
unsupportedFlag,

View File

@ -52,7 +52,7 @@ export default class ApiKeysCmd extends Command {
await getApplication(getBalenaSdk(), options.fleet, {
$select: 'actor',
})
).actor
).actor
: await getBalenaSdk().auth.getActorId();
const keys = await getBalenaSdk().pine.get({
resource: 'api_key',
@ -65,7 +65,7 @@ export default class ApiKeysCmd extends Command {
name: {
$ne: null,
},
}
}
: {}),
},
$orderby: 'name asc',

View File

@ -91,7 +91,7 @@ export default class DeviceCmd extends Command {
},
...expandForAppName.$expand,
},
}
}
: {
$select: [
'device_name',
@ -118,7 +118,7 @@ export default class DeviceCmd extends Command {
'is_undervolted',
],
...expandForAppName,
},
},
)) as ExtendedDevice;
if (options.view) {

View File

@ -132,7 +132,7 @@ export default class DeviceInitCmd extends Command {
$select: 'slug',
},
},
})
})
: await (await import('../../utils/patterns')).selectApplication();
// Register new device

View File

@ -126,7 +126,7 @@ export default class EnvsCmd extends Command {
let fleetSlug: string | undefined = options.fleet
? await (
await import('../../utils/sdk')
).getFleetSlug(balena, options.fleet)
).getFleetSlug(balena, options.fleet)
: undefined;
let fullUUID: string | undefined; // as oppposed to the short, 7-char UUID

View File

@ -19,7 +19,7 @@ import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { LogMessage } from 'balena-sdk';
import type { LogMessage } from 'balena-sdk';
const MAX_RETRY = 1000;

View File

@ -173,7 +173,7 @@ Can be repeated to add multiple certificates.\
const fleetSlug: string | undefined = options.fleet
? await (
await import('../../utils/sdk')
).getFleetSlug(balena, options.fleet)
).getFleetSlug(balena, options.fleet)
: undefined;
const progressBars: {

View File

@ -23,7 +23,7 @@ import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { dockerignoreHelp, registrySecretsHelp } from '../../utils/messages';
import type { BalenaSDK } from 'balena-sdk';
import { ExpectedError, instanceOf } from '../../errors';
import { RegistrySecrets } from '@balena/compose/dist/multibuild';
import type { RegistrySecrets } from '@balena/compose/dist/multibuild';
import { lowercaseIfSlug } from '../../utils/normalization';
import {
applyReleaseTagKeysAndValues,

View File

@ -78,7 +78,7 @@ export default class ReleasesCmd extends Command {
$select: ['tag_key', 'value'],
},
},
}
}
: { $select: fields },
);

View File

@ -88,7 +88,7 @@ async function outputDataSet(
...(options.json
? {
output: 'json',
}
}
: {}),
columns: options.fields,
printLine,
@ -147,7 +147,7 @@ function getLongestObjectKeyLength(o: any): number {
return Object.keys(o).length >= 1
? Object.keys(o).reduce((a, b) => {
return a.length > b.length ? a : b;
}).length
}).length
: 0;
}

View File

@ -30,7 +30,7 @@ import type {
} from './compose-types';
import { getChalk } from './lazy';
import Logger = require('./logger');
import { ProgressCallback } from 'docker-progress';
import type { ProgressCallback } from 'docker-progress';
export function generateOpts(options: {
source?: string;

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { BalenaSDK } from 'balena-sdk';
import type { BalenaSDK } from 'balena-sdk';
import type { TransposeOptions } from '@balena/compose/dist/emulate';
import type * as Dockerode from 'dockerode';
import { promises as fs } from 'fs';
@ -32,7 +32,7 @@ import * as semver from 'semver';
import type { Duplex, Readable } from 'stream';
import type { Pack } from 'tar-stream';
import { ExpectedError } from '../errors';
import {
import type {
BuiltImage,
ComposeOpts,
ComposeProject,

View File

@ -18,13 +18,13 @@
import * as semver from 'balena-semver';
import * as Docker from 'dockerode';
import * as _ from 'lodash';
import { Composition } from '@balena/compose/dist/parse';
import {
import type { Composition } from '@balena/compose/dist/parse';
import type {
BuildTask,
getAuthConfigObj,
LocalImage,
RegistrySecrets,
} from '@balena/compose/dist/multibuild';
import { getAuthConfigObj } from '@balena/compose/dist/multibuild';
import type { Readable } from 'stream';
import { BALENA_ENGINE_TMP_PATH } from '../../config';
@ -37,7 +37,8 @@ import {
makeImageName,
} from '../compose_ts';
import Logger = require('../logger');
import { DeviceAPI, DeviceInfo } from './api';
import type { DeviceInfo } from './api';
import { DeviceAPI } from './api';
import * as LocalPushErrors from './errors';
import LivepushManager from './live';
import { displayBuildLog } from './logs';

View File

@ -30,11 +30,8 @@ import Logger = require('../logger');
import { Dockerfile } from 'livepush';
import type DeviceAPI from './api';
import type { DeviceInfo, Status } from './api';
import {
DeviceDeployOptions,
generateTargetState,
rebuildSingleTask,
} from './deploy';
import type { DeviceDeployOptions } from './deploy';
import { generateTargetState, rebuildSingleTask } from './deploy';
import { BuildError } from './errors';
import { getServiceColourFn } from './logs';
import { delay } from '../helpers';

View File

@ -17,11 +17,11 @@ limitations under the License.
import { ExpectedError } from '../../errors';
import { stripIndent } from '../lazy';
import type { SshRemoteCommandOpts } from '../ssh';
import {
findBestUsernameForDevice,
getRemoteCommandOutput,
runRemoteCommand,
SshRemoteCommandOpts,
} from '../ssh';
export interface DeviceSSHOpts extends SshRemoteCommandOpts {

View File

@ -85,13 +85,13 @@ export function getVarResourceName(
? isConfig
? 'device_config_variable'
: isService
? 'device_service_environment_variable'
: 'device_environment_variable'
? 'device_service_environment_variable'
: 'device_environment_variable'
: isConfig
? 'application_config_variable'
: isService
? 'service_environment_variable'
: 'application_environment_variable';
? 'application_config_variable'
: isService
? 'service_environment_variable'
: 'application_environment_variable';
}
/**

View File

@ -15,7 +15,8 @@
* limitations under the License.
*/
import * as _ from 'lodash';
import { promises as fs, Stats } from 'fs';
import type { Stats } from 'fs';
import { promises as fs } from 'fs';
import * as path from 'path';
import type { Ignore } from '@balena/dockerignore';

View File

@ -18,7 +18,7 @@
import type { Options as GlobalTunnelNgConfig } from 'global-tunnel-ng';
export type { GlobalTunnelNgConfig };
import { CliSettings } from './bootstrap';
import type { CliSettings } from './bootstrap';
type ProxyConfig = string | GlobalTunnelNgConfig;

View File

@ -17,7 +17,7 @@ import type { BalenaSDK } from 'balena-sdk';
import * as JSONStream from 'JSONStream';
import * as readline from 'readline';
import * as request from 'request';
import { RegistrySecrets } from '@balena/compose/dist/multibuild';
import type { RegistrySecrets } from '@balena/compose/dist/multibuild';
import type * as Stream from 'stream';
import streamToPromise = require('stream-to-promise');
import type { Pack } from 'tar-stream';

View File

@ -14,7 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { spawn, StdioOptions } from 'child_process';
import type { StdioOptions } from 'child_process';
import { spawn } from 'child_process';
import * as _ from 'lodash';
import { ExpectedError } from '../errors';

View File

@ -15,7 +15,8 @@
* limitations under the License.
*/
import { ChildProcess, spawn, SpawnOptions } from 'child_process';
import type { ChildProcess, SpawnOptions } from 'child_process';
import { spawn } from 'child_process';
import { stripIndent } from './lazy';
/**

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import type { BalenaSDK } from 'balena-sdk';
import { Socket } from 'net';
import type { Socket } from 'net';
import * as tls from 'tls';
import { TypedError } from 'typed-error';
import { ExpectedError } from '../errors';

1485
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -117,7 +117,7 @@
}
},
"devDependencies": {
"@balena/lint": "^7.2.1",
"@balena/lint": "^8.0.0",
"@electron/notarize": "^2.0.0",
"@octokit/plugin-throttling": "^3.5.1",
"@octokit/rest": "^18.6.7",

View File

@ -26,9 +26,11 @@ import { BalenaAPIMock } from '../nock/balena-api-mock';
import { expectStreamNoCRLF, testDockerBuildStream } from '../docker-build';
import { DockerMock, dockerResponsePath } from '../nock/docker-mock';
import { cleanOutput, runCommand } from '../helpers';
import {
import type {
ExpectedTarStreamFiles,
ExpectedTarStreamFilesByService,
} from '../projects';
import {
getDockerignoreWarn1,
getDockerignoreWarn2,
getDockerignoreWarn3,

View File

@ -20,7 +20,7 @@ import type { Request as ReleaseRequest } from '@balena/compose/dist/release';
import { expect } from 'chai';
import { promises as fs } from 'fs';
import * as _ from 'lodash';
import * as nock from 'nock';
import type * as nock from 'nock';
import * as path from 'path';
import * as sinon from 'sinon';
@ -28,12 +28,11 @@ import { BalenaAPIMock } from '../nock/balena-api-mock';
import { expectStreamNoCRLF, testDockerBuildStream } from '../docker-build';
import { DockerMock, dockerResponsePath } from '../nock/docker-mock';
import { cleanOutput, runCommand, switchSentry } from '../helpers';
import {
import type {
ExpectedTarStreamFiles,
ExpectedTarStreamFilesByService,
getDockerignoreWarn1,
getDockerignoreWarn3,
} from '../projects';
import { getDockerignoreWarn1, getDockerignoreWarn3 } from '../projects';
const repoPath = path.normalize(path.join(__dirname, '..', '..'));
const projectsPath = path.join(repoPath, 'tests', 'test-data', 'projects');

View File

@ -23,10 +23,10 @@ import { BalenaAPIMock } from '../nock/balena-api-mock';
import { BuilderMock, builderResponsePath } from '../nock/builder-mock';
import { expectStreamNoCRLF, testPushBuildStream } from '../docker-build';
import { cleanOutput, runCommand } from '../helpers';
import type { ExpectedTarStreamFiles } from '../projects';
import {
addRegSecretsEntries,
exists,
ExpectedTarStreamFiles,
getDockerignoreWarn1,
getDockerignoreWarn2,
getDockerignoreWarn3,

View File

@ -17,7 +17,8 @@
import { expect } from 'chai';
import mock = require('mock-require');
import { createServer, Server } from 'net';
import type { Server } from 'net';
import { createServer } from 'net';
import { BalenaAPIMock } from '../nock/balena-api-mock';
import { cleanOutput, runCommand } from '../helpers';

View File

@ -23,13 +23,12 @@ import * as semver from 'semver';
import * as sinon from 'sinon';
import * as packageJSON from '../package.json';
import {
DeprecationChecker,
ReleaseTimestampsByVersion,
} from '../build/deprecation';
import type { ReleaseTimestampsByVersion } from '../build/deprecation';
import { DeprecationChecker } from '../build/deprecation';
import { BalenaAPIMock } from './nock/balena-api-mock';
import { NpmMock } from './nock/npm-mock';
import { runCommand, TestOutput } from './helpers';
import type { TestOutput } from './helpers';
import { runCommand } from './helpers';
// "itSS" means "it() Skip Standalone"
const itSS = process.env.BALENA_CLI_TEST_TYPE === 'standalone' ? it.skip : it;

View File

@ -29,15 +29,15 @@ import { URL } from 'url';
import { makeImageName } from '../build/utils/compose_ts';
import { stripIndent } from '../build/utils/lazy';
import { BuilderMock } from './nock/builder-mock';
import { DockerMock } from './nock/docker-mock';
import type { BuilderMock } from './nock/builder-mock';
import type { DockerMock } from './nock/docker-mock';
import {
cleanOutput,
deepJsonParse,
deepTemplateReplace,
runCommand,
} from './helpers';
import {
import type {
ExpectedTarStreamFile,
ExpectedTarStreamFiles,
ExpectedTarStreamFilesByService,

View File

@ -18,7 +18,8 @@
import * as _ from 'lodash';
import * as path from 'path';
import { NockMock, ScopeOpts } from './nock-mock';
import type { ScopeOpts } from './nock-mock';
import { NockMock } from './nock-mock';
export const apiResponsePath = path.normalize(
path.join(__dirname, '..', 'test-data', 'api-response'),

View File

@ -18,7 +18,8 @@
import * as path from 'path';
import * as qs from 'querystring';
import { NockMock, ScopeOpts } from './nock-mock';
import type { ScopeOpts } from './nock-mock';
import { NockMock } from './nock-mock';
export const dockerResponsePath = path.normalize(
path.join(__dirname, '..', 'test-data', 'docker-response'),

View File

@ -17,7 +17,8 @@
import * as path from 'path';
import { Readable } from 'stream';
import { NockMock, ScopeOpts } from './nock-mock';
import type { ScopeOpts } from './nock-mock';
import { NockMock } from './nock-mock';
export const dockerResponsePath = path.normalize(
path.join(__dirname, '..', 'test-data', 'docker-response'),

View File

@ -17,10 +17,8 @@
import { expect } from 'chai';
import {
GlobalTunnelNgConfig,
makeUrlFromTunnelNgConfig,
} from '../build/utils/proxy';
import type { GlobalTunnelNgConfig } from '../build/utils/proxy';
import { makeUrlFromTunnelNgConfig } from '../build/utils/proxy';
describe('makeUrlFromTunnelNgConfig() function', function () {
it('should return a URL given a GlobalTunnelNgConfig object', () => {

View File

@ -16,7 +16,7 @@
*/
import { expect } from 'chai';
import * as chokidar from 'chokidar';
import type * as chokidar from 'chokidar';
import { promises as fs } from 'fs';
import * as path from 'path';
import { promisify } from 'util';

View File

@ -17,8 +17,8 @@
import { expect } from 'chai';
import type { DockerConnectionCliFlags } from '../../build/utils/docker';
import {
DockerConnectionCliFlags,
generateConnectOpts,
getDefaultDockerModemOpts,
} from '../../build/utils/docker';

View File

@ -17,7 +17,7 @@
declare module 'balena-device-init' {
import { DeviceTypeJson } from 'balena-sdk';
import * as Bluebird from 'bluebird';
import type * as Bluebird from 'bluebird';
interface OperationState {
operation:

2
typings/global.d.ts vendored
View File

@ -1,4 +1,4 @@
import { Application, DeviceType, Device } from 'balena-sdk';
import type { Application, DeviceType, Device } from 'balena-sdk';
declare global {
type ApplicationWithDeviceTypeSlug = Omit<