mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 13:26:24 +00:00
Bump balena-lint to 7.2.1
Change-type: patch
This commit is contained in:
parent
1ffa8d38f1
commit
7d13946c3e
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@ -0,0 +1,2 @@
|
||||
/completion/*
|
||||
/bin/*
|
21
.eslintrc.js
Normal file
21
.eslintrc.js
Normal file
@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@balena/lint/config/.eslintrc.js'],
|
||||
parserOptions: {
|
||||
project: 'tsconfig.dev.json',
|
||||
},
|
||||
root: true,
|
||||
rules: {
|
||||
ignoreDefinitionFiles: 0,
|
||||
// to avoid the `warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion`
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-shadow': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: ['resin-cli-visuals', 'chalk', 'common-tags', 'resin-cli-form'],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
},
|
||||
};
|
@ -25,7 +25,6 @@ import * as filehound from 'filehound';
|
||||
import { Stats } from 'fs';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as klaw from 'klaw';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import * as rimraf from 'rimraf';
|
||||
import * as semver from 'semver';
|
||||
|
@ -104,5 +104,5 @@ async function printMarkdown() {
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
printMarkdown();
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// tslint:disable-next-line:import-blacklist
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { stripIndent } from 'common-tags';
|
||||
import * as _ from 'lodash';
|
||||
import { promises as fs } from 'fs';
|
||||
@ -82,5 +82,5 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
run();
|
||||
|
@ -23,8 +23,8 @@ function parseSemver(version) {
|
||||
* @param {string} v2
|
||||
*/
|
||||
function semverGte(v1, v2) {
|
||||
let v1Array = parseSemver(v1);
|
||||
let v2Array = parseSemver(v2);
|
||||
const v1Array = parseSemver(v1);
|
||||
const v2Array = parseSemver(v2);
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (v1Array[i] < v2Array[i]) {
|
||||
return false;
|
||||
|
@ -30,7 +30,7 @@ const { GITHUB_TOKEN } = process.env;
|
||||
export async function createGitHubRelease() {
|
||||
console.log(`Publishing release ${version} to GitHub`);
|
||||
const publishRelease = await import('publish-release');
|
||||
const ghRelease = await Bluebird.fromCallback(
|
||||
const ghRelease = (await Bluebird.fromCallback(
|
||||
publishRelease.bind(null, {
|
||||
token: GITHUB_TOKEN || '',
|
||||
owner: 'balena-io',
|
||||
@ -40,7 +40,7 @@ export async function createGitHubRelease() {
|
||||
reuseRelease: true,
|
||||
assets: finalReleaseAssets[process.platform],
|
||||
}),
|
||||
);
|
||||
)) as { html_url: any };
|
||||
console.log(`Release ${version} successful: ${ghRelease.html_url}`);
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ async function updateGitHubReleaseDescriptions(
|
||||
) {
|
||||
const perPage = 30;
|
||||
const octokit = getOctokit();
|
||||
const options = await octokit.repos.listReleases.endpoint.merge({
|
||||
const options = octokit.repos.listReleases.endpoint.merge({
|
||||
owner,
|
||||
repo,
|
||||
per_page: perPage,
|
||||
|
@ -60,7 +60,7 @@ async function parse(args?: string[]) {
|
||||
release,
|
||||
};
|
||||
for (const arg of args) {
|
||||
if (!commands.hasOwnProperty(arg)) {
|
||||
if (!Object.hasOwn(commands, arg)) {
|
||||
throw new Error(`command unknown: ${arg}`);
|
||||
}
|
||||
}
|
||||
@ -103,5 +103,5 @@ export async function run(args?: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
run();
|
||||
|
@ -136,5 +136,5 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
main();
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { spawn } from 'child_process';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
|
||||
export const ROOT = path.join(__dirname, '..');
|
||||
|
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// tslint:disable:no-var-requires
|
||||
|
||||
// We boost the threadpool size as ext2fs can deadlock with some
|
||||
// operations otherwise, if the pool runs out.
|
||||
process.env.UV_THREADPOOL_SIZE = '64';
|
||||
|
@ -5,8 +5,6 @@
|
||||
// Before opening a PR you should build and test your changes using bin/balena
|
||||
// ****************************************************************************
|
||||
|
||||
// tslint:disable:no-var-requires
|
||||
|
||||
// We boost the threadpool size as ext2fs can deadlock with some
|
||||
// operations otherwise, if the pool runs out.
|
||||
process.env.UV_THREADPOOL_SIZE = '64';
|
||||
|
@ -31,8 +31,8 @@ if (fs.existsSync(commandsFilePath)) {
|
||||
|
||||
const commandsJson = JSON.parse(fs.readFileSync(commandsFilePath, 'utf8'));
|
||||
|
||||
var mainCommands = [];
|
||||
var additionalCommands = [];
|
||||
const mainCommands = [];
|
||||
const additionalCommands = [];
|
||||
for (const key of Object.keys(commandsJson.commands)) {
|
||||
const cmd = key.split(':');
|
||||
if (cmd.length > 1) {
|
||||
@ -72,8 +72,8 @@ fs.readFile(bashFilePathIn, 'utf8', function (err, data) {
|
||||
/\$main_commands\$/g,
|
||||
'main_commands="' + mainCommandsStr + '"',
|
||||
);
|
||||
var subCommands = [];
|
||||
var prevElement = additionalCommands[0][0];
|
||||
let subCommands = [];
|
||||
let prevElement = additionalCommands[0][0];
|
||||
additionalCommands.forEach(function (element) {
|
||||
if (element[0] === prevElement) {
|
||||
subCommands.push(element[1]);
|
||||
@ -134,8 +134,8 @@ fs.readFile(zshFilePathIn, 'utf8', function (err, data) {
|
||||
/\$main_commands\$/g,
|
||||
'main_commands=( ' + mainCommandsStr + ' )',
|
||||
);
|
||||
var subCommands = [];
|
||||
var prevElement = additionalCommands[0][0];
|
||||
let subCommands = [];
|
||||
let prevElement = additionalCommands[0][0];
|
||||
additionalCommands.forEach(function (element) {
|
||||
if (element[0] === prevElement) {
|
||||
subCommands.push(element[1]);
|
||||
|
@ -52,7 +52,6 @@ export default class RevokeCmd extends Command {
|
||||
public async run() {
|
||||
const { args: params } = await this.parse(RevokeCmd);
|
||||
|
||||
try {
|
||||
const apiKeyIds = params.ids.split(',');
|
||||
if (apiKeyIds.filter((apiKeyId) => !apiKeyId.match(/^\d+$/)).length > 0) {
|
||||
console.log('API key ids must be positive integers');
|
||||
@ -64,8 +63,5 @@ export default class RevokeCmd extends Command {
|
||||
),
|
||||
);
|
||||
console.log('Successfully revoked the given API keys');
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ export default class ApiKeysCmd extends Command {
|
||||
public async run() {
|
||||
const { flags: options } = await this.parse(ApiKeysCmd);
|
||||
|
||||
try {
|
||||
const { getApplication } = await import('../../utils/sdk');
|
||||
const actorId = options.fleet
|
||||
? (
|
||||
@ -80,8 +79,5 @@ export default class ApiKeysCmd extends Command {
|
||||
fields,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,8 @@ export default class DeviceDeactivateCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DeviceDeactivateCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DeviceDeactivateCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
const patterns = await import('../../utils/patterns');
|
||||
|
@ -63,9 +63,8 @@ export default class DeviceLocalModeCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DeviceLocalModeCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DeviceLocalModeCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
|
@ -59,9 +59,8 @@ export default class DeviceOsUpdateCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DeviceOsUpdateCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DeviceOsUpdateCmd);
|
||||
|
||||
const sdk = getBalenaSdk();
|
||||
|
||||
|
@ -65,9 +65,8 @@ export default class DevicePublicUrlCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DevicePublicUrlCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DevicePublicUrlCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
|
@ -61,9 +61,8 @@ export default class DeviceRegisterCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DeviceRegisterCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DeviceRegisterCmd);
|
||||
|
||||
const { getApplication } = await import('../../utils/sdk');
|
||||
|
||||
|
@ -46,9 +46,8 @@ export default class DeviceShutdownCmd extends Command {
|
||||
public static authenticated = true;
|
||||
|
||||
public async run() {
|
||||
const { args: params, flags: options } = await this.parse(
|
||||
DeviceShutdownCmd,
|
||||
);
|
||||
const { args: params, flags: options } =
|
||||
await this.parse(DeviceShutdownCmd);
|
||||
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
|
@ -228,7 +228,8 @@ async function getAppVars(
|
||||
if (!fleetSlug) {
|
||||
return appVars;
|
||||
}
|
||||
const vars = await sdk.models.application[
|
||||
const vars =
|
||||
await sdk.models.application[
|
||||
options.config ? 'configVar' : 'envVar'
|
||||
].getAllByApplication(fleetSlug);
|
||||
fillInInfoFields(vars, fleetSlug);
|
||||
@ -269,9 +270,8 @@ async function getDeviceVars(
|
||||
const printedUUID = options.json ? fullUUID : options.device!;
|
||||
const deviceVars: EnvironmentVariableInfo[] = [];
|
||||
if (options.config) {
|
||||
const deviceConfigVars = await sdk.models.device.configVar.getAllByDevice(
|
||||
fullUUID,
|
||||
);
|
||||
const deviceConfigVars =
|
||||
await sdk.models.device.configVar.getAllByDevice(fullUUID);
|
||||
fillInInfoFields(deviceConfigVars, fleetSlug, printedUUID);
|
||||
deviceVars.push(...deviceConfigVars);
|
||||
} else {
|
||||
@ -296,9 +296,8 @@ async function getDeviceVars(
|
||||
fillInInfoFields(deviceServiceVars, fleetSlug, printedUUID);
|
||||
deviceVars.push(...deviceServiceVars);
|
||||
|
||||
const deviceEnvVars = await sdk.models.device.envVar.getAllByDevice(
|
||||
fullUUID,
|
||||
);
|
||||
const deviceEnvVars =
|
||||
await sdk.models.device.envVar.getAllByDevice(fullUUID);
|
||||
fillInInfoFields(deviceEnvVars, fleetSlug, printedUUID);
|
||||
deviceVars.push(...deviceEnvVars);
|
||||
}
|
||||
|
@ -390,9 +390,8 @@ Can be repeated to add multiple certificates.\
|
||||
);
|
||||
applicationInfoSpinner.start();
|
||||
|
||||
const applications = await this.getApplicationsWithSuccessfulBuilds(
|
||||
deviceTypeSlug,
|
||||
);
|
||||
const applications =
|
||||
await this.getApplicationsWithSuccessfulBuilds(deviceTypeSlug);
|
||||
applicationInfoSpinner.stop();
|
||||
if (applications.length === 0) {
|
||||
throw new ExpectedError(
|
||||
|
@ -204,12 +204,16 @@ export default class TunnelCmd extends Command {
|
||||
let localAddress = 'localhost';
|
||||
|
||||
// First element is always remotePort
|
||||
// TODO: figure out why we have explicitly passed `undefined` for the radix parameter
|
||||
// eslint-disable-next-line radix
|
||||
const remotePort = parseInt(mappingElements[0], undefined);
|
||||
let localPort = remotePort;
|
||||
|
||||
if (mappingElements.length === 2) {
|
||||
// [1] could be localAddress or localPort
|
||||
if (/^\d+$/.test(mappingElements[1])) {
|
||||
// TODO: figure out why we have explicitly passed `undefined` for the radix parameter
|
||||
// eslint-disable-next-line radix
|
||||
localPort = parseInt(mappingElements[1], undefined);
|
||||
} else {
|
||||
localAddress = mappingElements[1];
|
||||
@ -217,6 +221,8 @@ export default class TunnelCmd extends Command {
|
||||
} else if (mappingElements.length === 3) {
|
||||
// [1] is localAddress, [2] is localPort
|
||||
localAddress = mappingElements[1];
|
||||
// TODO: figure out why we have explicitly passed `undefined` for the radix parameter
|
||||
// eslint-disable-next-line radix
|
||||
localPort = parseInt(mappingElements[2], undefined);
|
||||
} else if (mappingElements.length > 3) {
|
||||
throw new InvalidPortMappingError(portMapping);
|
||||
|
@ -47,7 +47,7 @@ export function outputMessage(msg: string) {
|
||||
* @param options Output options
|
||||
*/
|
||||
export async function outputData(
|
||||
data: any[] | {},
|
||||
data: any[] | object,
|
||||
fields: string[],
|
||||
options: DataOutputOptions | DataSetOutputOptions,
|
||||
) {
|
||||
|
@ -240,9 +240,8 @@ export async function getOsVersions(
|
||||
): Promise<SDK.OsVersion[]> {
|
||||
const sdk = getBalenaSdk();
|
||||
let slug = deviceType;
|
||||
let versions: SDK.OsVersion[] = await sdk.models.os.getAvailableOsVersions(
|
||||
slug,
|
||||
);
|
||||
let versions: SDK.OsVersion[] =
|
||||
await sdk.models.os.getAvailableOsVersions(slug);
|
||||
// if slug is an alias, fetch the real slug
|
||||
if (!versions.length) {
|
||||
// unalias device type slug
|
||||
|
@ -31,7 +31,6 @@ import type * as MultiBuild from '@balena/compose/dist/multibuild';
|
||||
import * as semver from 'semver';
|
||||
import type { Duplex, Readable } from 'stream';
|
||||
import type { Pack } from 'tar-stream';
|
||||
|
||||
import { ExpectedError } from '../errors';
|
||||
import {
|
||||
BuiltImage,
|
||||
@ -1244,7 +1243,7 @@ async function pushAndUpdateServiceImages(
|
||||
afterEach: (
|
||||
serviceImage: import('@balena/compose/dist/release/models').ImageModel,
|
||||
props: object,
|
||||
) => void,
|
||||
) => Promise<void>,
|
||||
) {
|
||||
const { DockerProgress } = await import('docker-progress');
|
||||
const { retry } = await import('./helpers');
|
||||
|
@ -194,6 +194,7 @@ export class LivepushManager {
|
||||
);
|
||||
const eventQueue = this.updateEventsWaiting[$serviceName];
|
||||
eventQueue.push(changedPath);
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.getDebouncedEventHandler($serviceName)();
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-restricted-imports */
|
||||
/** the import blacklist is to enforce lazy loading so exempt this file */
|
||||
/*
|
||||
Copyright 2020 Balena
|
||||
|
||||
@ -14,8 +16,6 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// tslint:disable:import-blacklist - the import blacklist is to enforce lazy loading so exempt this file
|
||||
|
||||
import type * as BalenaSdk from 'balena-sdk';
|
||||
import type { Chalk } from 'chalk';
|
||||
import type * as visuals from 'resin-cli-visuals';
|
||||
|
@ -29,7 +29,7 @@ import { getBalenaSdk, getVisuals, stripIndent, getCliForm } from './lazy';
|
||||
import validation = require('./validation');
|
||||
import { delay } from './helpers';
|
||||
|
||||
export function authenticate(options: {}): Promise<void> {
|
||||
export function authenticate(options: object): Promise<void> {
|
||||
const balena = getBalenaSdk();
|
||||
return getCliForm()
|
||||
.run(
|
||||
|
@ -16,10 +16,11 @@ limitations under the License.
|
||||
|
||||
import type { OptionalNavigationResource } from 'balena-sdk';
|
||||
|
||||
export const getExpanded = <T extends {}>(obj: OptionalNavigationResource<T>) =>
|
||||
(Array.isArray(obj) && obj[0]) || undefined;
|
||||
export const getExpanded = <T extends object>(
|
||||
obj: OptionalNavigationResource<T>,
|
||||
) => (Array.isArray(obj) && obj[0]) || undefined;
|
||||
|
||||
export const getExpandedProp = <T extends {}, K extends keyof T>(
|
||||
export const getExpandedProp = <T extends object, K extends keyof T>(
|
||||
obj: OptionalNavigationResource<T>,
|
||||
key: K,
|
||||
) => (Array.isArray(obj) && obj[0] && obj[0][key]) || undefined;
|
||||
|
@ -394,7 +394,9 @@ async function createApplication(
|
||||
throw new sdk.errors.BalenaNotLoggedIn();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
const applicationName = await new Promise<string>(async (resolve, reject) => {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
const appName = await getCliForm().ask({
|
||||
|
@ -194,7 +194,7 @@ async function handleHeadlessBuildStream(
|
||||
|
||||
function handleBuilderMetadata(obj: BuilderMessage, build: RemoteBuild) {
|
||||
switch (obj.resource) {
|
||||
case 'cursor':
|
||||
case 'cursor': {
|
||||
if (obj.value == null) {
|
||||
return;
|
||||
}
|
||||
@ -228,6 +228,7 @@ function handleBuilderMetadata(obj: BuilderMessage, build: RemoteBuild) {
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 'buildLogId':
|
||||
// The name of this resource is slightly dated, but this is the release
|
||||
// id from the API. We need to save this so that if the user ctrl+c's the
|
||||
|
4962
npm-shrinkwrap.json
generated
4962
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -112,7 +112,7 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@balena/lint": "^6.2.2",
|
||||
"@balena/lint": "^7.2.1",
|
||||
"@electron/notarize": "^2.0.0",
|
||||
"@octokit/plugin-throttling": "^3.5.1",
|
||||
"@octokit/rest": "^18.6.7",
|
||||
@ -123,6 +123,7 @@
|
||||
"@types/chai-as-promised": "^7.1.4",
|
||||
"@types/cli-truncate": "^2.0.0",
|
||||
"@types/common-tags": "^1.8.1",
|
||||
"@types/diff": "^5.0.3",
|
||||
"@types/dockerode": "^3.3.9",
|
||||
"@types/ejs": "^3.1.0",
|
||||
"@types/express": "^4.17.13",
|
||||
@ -161,6 +162,7 @@
|
||||
"@types/through2": "^2.0.36",
|
||||
"@types/tmp": "^0.2.3",
|
||||
"@types/which": "^2.0.1",
|
||||
"@types/window-size": "^1.1.1",
|
||||
"archiver": "^5.3.0",
|
||||
"catch-uncommitted": "^2.0.0",
|
||||
"chai": "^4.3.4",
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { expect } from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
import mock = require('mock-require');
|
||||
import * as mock from 'mock-require';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
@ -32,6 +32,7 @@ describe('balena config write', function () {
|
||||
[{ a: 'b' }, 'a', 2, { a: 2 }],
|
||||
[{ a: ['b'] }, 'a', 2, { a: 2 }],
|
||||
[{ a: ['b'] }, 'a.1', 'c', { a: ['b', 'c'] }],
|
||||
// eslint-disable-next-line no-sparse-arrays
|
||||
[{ a: ['b'] }, 'a.2', 'c', { a: ['b', , 'c'] }],
|
||||
[{ a: { '1': 'b' } }, 'a.1', 'c', { a: { '1': 'c' } }],
|
||||
[{ a: { '1': 'b' } }, 'a.2', 'c', { a: { '1': 'b', '2': 'c' } }],
|
||||
|
@ -326,7 +326,7 @@ describe('balena deploy', function () {
|
||||
});
|
||||
} finally {
|
||||
await switchSentry(sentryStatus);
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error claims restore does not exist
|
||||
process.exit.restore();
|
||||
}
|
||||
});
|
||||
|
@ -218,7 +218,7 @@ export async function testDockerBuildStream(o: {
|
||||
}
|
||||
if (o.expectedExitCode != null) {
|
||||
if (process.env.BALENA_CLI_TEST_TYPE !== 'standalone') {
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error claims the typing doesn't match
|
||||
sinon.assert.calledWith(process.exit);
|
||||
}
|
||||
expect(o.expectedExitCode).to.equal(exitCode);
|
||||
|
@ -48,7 +48,7 @@ describe('handleError() function', () => {
|
||||
'printExpectedErrorMessage',
|
||||
);
|
||||
captureException = sinon.stub();
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error TODO: get explanation for why this ts-expect-error is necessary
|
||||
sandbox.stub(ErrorsModule, 'getSentry').resolves({ captureException });
|
||||
processExit = sandbox.stub(process, 'exit');
|
||||
|
||||
|
@ -268,6 +268,7 @@ export function cleanOutput(
|
||||
* coded from observation of a few samples only, and may not cover all cases.
|
||||
*/
|
||||
export function monochrome(text: string): string {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
return text.replace(/\u001b\[\??(\d+;)*\d+[a-zA-Z]\r?/g, '');
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,8 @@ export class BuilderMock extends NockMock {
|
||||
checkURI: (uri: string) => Promise<void>;
|
||||
checkBuildRequestBody: (requestBody: string | Buffer) => Promise<void>;
|
||||
}) {
|
||||
this.optPost(/^\/v3\/build($|[(?])/, opts).reply(async function (
|
||||
uri,
|
||||
requestBody,
|
||||
callback,
|
||||
) {
|
||||
this.optPost(/^\/v3\/build($|[(?])/, opts).reply(
|
||||
async function (uri, requestBody, callback) {
|
||||
let error: Error | null = null;
|
||||
try {
|
||||
await opts.checkURI(uri);
|
||||
@ -61,6 +58,7 @@ export class BuilderMock extends NockMock {
|
||||
error = err;
|
||||
}
|
||||
callback(error, [opts.responseCode, opts.responseBody]);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
import { expect } from 'chai';
|
||||
import * as chokidar from 'chokidar';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import { promisify } from 'util';
|
||||
|
||||
|
@ -26,15 +26,15 @@ describe('getProxyConfig() function', function () {
|
||||
|
||||
this.beforeEach(() => {
|
||||
originalProxyConfig = [
|
||||
global.hasOwnProperty('PROXY_CONFIG'),
|
||||
Object.hasOwn(global, 'PROXY_CONFIG'),
|
||||
(global as any).PROXY_CONFIG,
|
||||
];
|
||||
originalHttpProxy = [
|
||||
process.env.hasOwnProperty('HTTP_PROXY'),
|
||||
Object.hasOwn(process.env, 'HTTP_PROXY'),
|
||||
process.env.HTTP_PROXY,
|
||||
];
|
||||
originalHttpsProxy = [
|
||||
process.env.hasOwnProperty('HTTPS_PROXY'),
|
||||
Object.hasOwn(process.env, 'HTTPS_PROXY'),
|
||||
process.env.HTTPS_PROXY,
|
||||
];
|
||||
delete (global as any).PROXY_CONFIG;
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import * as tar from 'tar-stream';
|
||||
|
||||
|
@ -20,8 +20,5 @@
|
||||
],
|
||||
"preserveSymlinks": true
|
||||
},
|
||||
"include": [
|
||||
"./lib/**/*",
|
||||
"./typings/**/*"
|
||||
]
|
||||
"include": ["./lib/**/*", "./typings/**/*"]
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "./node_modules/@balena/lint/config/tslint-prettier.json",
|
||||
"rules": {
|
||||
"ignoreDefinitionFiles": false,
|
||||
"import-blacklist": [true, "resin-cli-visuals", "chalk", "common-tags", "resin-cli-form"]
|
||||
}
|
||||
}
|
7
typings/balena-device-init/index.d.ts
vendored
7
typings/balena-device-init/index.d.ts
vendored
@ -18,7 +18,6 @@
|
||||
declare module 'balena-device-init' {
|
||||
import { DeviceTypeJson } from 'balena-sdk';
|
||||
import * as Bluebird from 'bluebird';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
interface OperationState {
|
||||
operation:
|
||||
@ -82,14 +81,14 @@ declare module 'balena-device-init' {
|
||||
export function configure(
|
||||
image: string,
|
||||
manifest: BalenaSdk.DeviceTypeJson.DeviceType.DeviceType,
|
||||
config: {},
|
||||
options?: {},
|
||||
config: object,
|
||||
options?: object,
|
||||
): Bluebird<InitializeEmitter>;
|
||||
|
||||
export function initialize(
|
||||
image: string,
|
||||
manifest: BalenaSdk.DeviceTypeJson.DeviceType.DeviceType,
|
||||
config: {},
|
||||
config: object,
|
||||
): Bluebird<InitializeEmitter>;
|
||||
|
||||
export function getImageOsVersion(
|
||||
|
6
typings/capitano/index.d.ts
vendored
6
typings/capitano/index.d.ts
vendored
@ -20,7 +20,7 @@ declare module 'capitano' {
|
||||
|
||||
export interface Cli {
|
||||
command: string;
|
||||
options: {};
|
||||
options: object;
|
||||
global: {
|
||||
help?: boolean;
|
||||
};
|
||||
@ -30,12 +30,13 @@ declare module 'capitano' {
|
||||
signature: string;
|
||||
description?: string;
|
||||
parameter?: string;
|
||||
// eslint-disable-next-line id-denylist
|
||||
boolean?: boolean;
|
||||
required?: string;
|
||||
alias?: string | string[];
|
||||
}
|
||||
|
||||
export interface CommandDefinition<P = {}, O = {}> {
|
||||
export interface CommandDefinition<P = object, O = object> {
|
||||
signature: string;
|
||||
description?: string;
|
||||
help?: string;
|
||||
@ -65,6 +66,7 @@ declare module 'capitano' {
|
||||
export interface Option {
|
||||
signature: Signature;
|
||||
alias: string | string[];
|
||||
// eslint-disable-next-line id-denylist
|
||||
boolean: boolean;
|
||||
parameter: string;
|
||||
required: boolean | string;
|
||||
|
4
typings/color-hash/index.d.ts
vendored
4
typings/color-hash/index.d.ts
vendored
@ -16,10 +16,6 @@
|
||||
*/
|
||||
|
||||
declare module 'color-hash' {
|
||||
interface Hasher {
|
||||
hex(text: string): string;
|
||||
}
|
||||
|
||||
class ColorHash {
|
||||
public hex(text: string): string;
|
||||
public rgb(text: string): [number, number, number];
|
||||
|
1
typings/common-tags/index.d.ts
vendored
1
typings/common-tags/index.d.ts
vendored
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
declare module 'common-tags/lib/stripIndent' {
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { stripIndent } from 'common-tags';
|
||||
|
||||
export = stripIndent;
|
||||
|
Loading…
Reference in New Issue
Block a user