Update resin-lint and prettier, and re-prettify

Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
This commit is contained in:
Paulo Castro 2020-01-20 21:21:05 +00:00
parent cc5fe60a15
commit b978230f9e
20 changed files with 87 additions and 130 deletions

View File

@ -183,9 +183,7 @@ async function testPkg() {
}
if (semver.major(process.version) !== pkgNodeMajorVersion) {
throw new Error(
`Mismatched major version: built-in pkg Node version="${pkgNodeVersion}" vs process.version="${
process.version
}"`,
`Mismatched major version: built-in pkg Node version="${pkgNodeVersion}" vs process.version="${process.version}"`,
);
}
console.log('Success! (standalone package test successful)');

View File

@ -127,9 +127,7 @@ export class MarkdownFileParser {
} else {
reject(
new Error(
`Markdown section not found: title="${title}" file="${
this.mdFilePath
}"`,
`Markdown section not found: title="${title}" file="${this.mdFilePath}"`,
),
);
}

View File

@ -74,9 +74,7 @@ function getOctokit(): any {
throttle: {
onRateLimit: (retryAfter: number, options: any) => {
console.warn(
`Request quota exhausted for request ${options.method} ${
options.url
}`,
`Request quota exhausted for request ${options.method} ${options.url}`,
);
// retries 3 times
if (options.request.retryCount < 3) {
@ -174,9 +172,7 @@ async function updateGitHubReleaseDescriptions(
);
continue;
}
const skipMsg = `${prefix} skipping release "${cliRelease.tag_name}" (${
cliRelease.id
})`;
const skipMsg = `${prefix} skipping release "${cliRelease.tag_name}" (${cliRelease.id})`;
if (cliRelease.draft === true) {
console.info(`${skipMsg}: draft release`);
continue;
@ -201,9 +197,7 @@ async function updateGitHubReleaseDescriptions(
}
}
console.info(
`${prefix} updating release "${cliRelease.tag_name}" (${
cliRelease.id
}) old body="${oldBodyPreview}"`,
`${prefix} updating release "${cliRelease.tag_name}" (${cliRelease.id}) old body="${oldBodyPreview}"`,
);
try {
await octokit.repos.updateRelease(updatedRelease);

View File

@ -80,9 +80,9 @@ export default class DevicesSupportedCmd extends Command {
public async run() {
const { flags: options } = this.parse<FlagsDef, {}>(DevicesSupportedCmd);
const sdk = SDK.fromSharedOptions();
let deviceTypes: Array<
Partial<DeviceTypeWithAliases>
> = await sdk.models.config.getDeviceTypes();
let deviceTypes: Array<Partial<
DeviceTypeWithAliases
>> = await sdk.models.config.getDeviceTypes();
if (!options.discontinued) {
deviceTypes = deviceTypes.filter(dt => dt.state !== 'DISCONTINUED');
}

View File

@ -299,9 +299,7 @@ async function getDeviceVars(
deviceVars.push(...deviceConfigVars);
} else {
if (options.service || options.all) {
const pineOpts: SDK.PineOptionsFor<
SDK.DeviceServiceEnvironmentVariable
> = {
const pineOpts: SDK.PineOptionsFor<SDK.DeviceServiceEnvironmentVariable> = {
$expand: {
service_install: {
$expand: 'installs__service',

View File

@ -306,9 +306,7 @@ async function checkDeviceTypeCompatibility(
const helpers = await import('../../utils/helpers');
if (!helpers.areDeviceTypesCompatible(appDeviceType, optionDeviceType)) {
throw new ExpectedError(
`Device type ${
options['device-type']
} is incompatible with application ${options.application}`,
`Device type ${options['device-type']} is incompatible with application ${options.application}`,
);
}
}

View File

@ -88,9 +88,7 @@ async function getAppOwner(sdk: BalenaSDK, appName: string) {
});
const selected = await selectFromList(
`${
entries.length
} applications found with that name, please select the application you would like to push to`,
`${entries.length} applications found with that name, please select the application you would like to push to`,
entries,
);

View File

@ -58,17 +58,13 @@ async function getContainerId(
});
if (request.status !== 200) {
throw new Error(
`There was an error connecting to device ${uuid}, HTTP response code: ${
request.status
}.`,
`There was an error connecting to device ${uuid}, HTTP response code: ${request.status}.`,
);
}
const body = request.body;
if (body.status !== 'success') {
throw new Error(
`There was an error communicating with device ${uuid}.\n\tError: ${
body.message
}`,
`There was an error communicating with device ${uuid}.\n\tError: ${body.message}`,
);
}
containerId = body.services[serviceName];

View File

@ -206,9 +206,7 @@ export const tunnel: CommandDefinition<Args, Options> = {
)
.then(() => {
logger.logInfo(
` - tunnelling ${localAddress}:${localPort} to ${
device.uuid
}:${remotePort}`,
` - tunnelling ${localAddress}:${localPort} to ${device.uuid}:${remotePort}`,
);
return true;

View File

@ -45,9 +45,7 @@ function checkNodeVersion() {
const { stripIndent } = require('common-tags');
console.warn(stripIndent`
------------------------------------------------------------------------------
Warning: Node version "${
process.version
}" does not match required versions "${validNodeVersions}".
Warning: Node version "${process.version}" does not match required versions "${validNodeVersions}".
This may cause unexpected behavior. To upgrade Node, visit:
https://nodejs.org/en/download/
------------------------------------------------------------------------------

View File

@ -30,9 +30,7 @@ export interface AppOptions {
export async function routeCliFramework(argv: string[], options: AppOptions) {
if (process.env.DEBUG) {
console.log(
`[debug] original argv0="${process.argv0}" argv=[${argv}] length=${
argv.length
}`,
`[debug] original argv0="${process.argv0}" argv=[${argv}] length=${argv.length}`,
);
}
const cmdSlice = argv.slice(2);

View File

@ -157,9 +157,7 @@ async function parseRegistrySecrets(
return registrySecrets;
} catch (error) {
return exitWithExpectedError(
`Error validating registry secrets file "${secretsFilename}":\n${
error.message
}`,
`Error validating registry secrets file "${secretsFilename}":\n${error.message}`,
);
}
}
@ -252,9 +250,7 @@ async function performResolution(
buildTask.buildStream = clonedStream;
if (!buildTask.external && !buildTask.resolved) {
throw new Error(
`Project type for service "${
buildTask.serviceName
}" could not be determined. Missing a Dockerfile?`,
`Project type for service "${buildTask.serviceName}" could not be determined. Missing a Dockerfile?`,
);
}
return buildTask;

View File

@ -95,9 +95,7 @@ async function environmentFromInput(
// exists
if (!(match[1] in ret)) {
logger.logDebug(
`Warning: Cannot find a service with name ${
match[1]
}. Treating the string as part of the environment variable name.`,
`Warning: Cannot find a service with name ${match[1]}. Treating the string as part of the environment variable name.`,
);
match[2] = `${match[1]}:${match[2]}`;
} else {
@ -135,9 +133,7 @@ export async function deployToDevice(opts: DeviceDeployOptions): Promise<void> {
await api.ping();
} catch (e) {
exitWithExpectedError(
`Could not communicate with local mode device at address ${
opts.deviceHost
}`,
`Could not communicate with local mode device at address ${opts.deviceHost}`,
);
}

View File

@ -45,13 +45,9 @@ export function stateToString(state: OperationState) {
switch (state.operation.command) {
case 'copy':
return `${result} ${state.operation.from.path} -> ${
state.operation.to.path
}`;
return `${result} ${state.operation.from.path} -> ${state.operation.to.path}`;
case 'replace':
return `${result} ${state.operation.file.path}, ${
state.operation.copy
} -> ${state.operation.replace}`;
return `${result} ${state.operation.file.path}, ${state.operation.copy} -> ${state.operation.replace}`;
case 'run-script':
return `${result} ${state.operation.script}`;
default:

View File

@ -116,7 +116,10 @@ export class FileIgnorer {
}
// Don't ignore Dockerfile (with or without extension) or docker-compose.yml
if (/^Dockerfile$|^Dockerfile\.\S+/.test(path.basename(relFile)) || path.basename(relFile) === 'docker-compose.yml') {
if (
/^Dockerfile$|^Dockerfile\.\S+/.test(path.basename(relFile)) ||
path.basename(relFile) === 'docker-compose.yml'
) {
return true;
}

View File

@ -366,10 +366,12 @@ export async function getOnlineTargetUuid(
logger.logDebug(
`Fetching device by UUID ${applicationOrDevice} (${typeof applicationOrDevice})`,
);
return (await sdk.models.device.get(applicationOrDevice, {
$select: ['uuid'],
$filter: { is_online: true },
})).uuid;
return (
await sdk.models.device.get(applicationOrDevice, {
$select: ['uuid'],
$filter: { is_online: true },
})
).uuid;
}
// otherwise, it may be a device OR an application...
@ -409,10 +411,12 @@ export async function getOnlineTargetUuid(
logger.logDebug(
`Fetching device by UUID ${applicationOrDevice} (${typeof applicationOrDevice})`,
);
return (await sdk.models.device.get(applicationOrDevice, {
$select: ['uuid'],
$filter: { is_online: true },
})).uuid;
return (
await sdk.models.device.get(applicationOrDevice, {
$select: ['uuid'],
$filter: { is_online: true },
})
).uuid;
}
export function selectFromList<T>(

View File

@ -332,9 +332,7 @@ function createRemoteBuildRequest(
if (response.statusCode >= 100 && response.statusCode < 400) {
if (DEBUG_MODE) {
console.error(
`[debug] received HTTP ${response.statusCode} ${
response.statusMessage
}`,
`[debug] received HTTP ${response.statusCode} ${response.statusMessage}`,
);
}
} else {

98
npm-shrinkwrap.json generated
View File

@ -707,9 +707,9 @@
"dev": true
},
"@types/prettier": {
"version": "1.16.4",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.16.4.tgz",
"integrity": "sha512-MG7ExKBo7AQ5UrL1awyYLNinNM/kyXgE4iP4Ul9fB+T7n768Z5Xem8IZeP6Bna0xze8gkDly49Rgge2HOEw4xA==",
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.0.tgz",
"integrity": "sha512-gDE8JJEygpay7IjA/u3JiIURvwZW08f0cZSZLAzFoX/ZmeqvS0Sqv+97aKuHpNsalAMMhwPe+iAS6fQbfmbt7A==",
"dev": true
},
"@types/prettyjson": {
@ -3033,6 +3033,12 @@
"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",
@ -3760,17 +3766,6 @@
"lru-cache": "^4.0.1",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
},
"dependencies": {
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
}
}
},
"execa": {
@ -3905,6 +3900,15 @@
"read-pkg": "^2.0.0"
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
},
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
@ -3949,9 +3953,9 @@
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"deprecate": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/deprecate/-/deprecate-1.1.0.tgz",
"integrity": "sha512-b5dDNQYdy2vW9WXUD8+RQlfoxvqztLLhDE+T7Gd37I5E8My7nJkKu6FmhdDeRWJ8B+yjZKuwjCta8pgi8kgSqA==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/deprecate/-/deprecate-1.1.1.tgz",
"integrity": "sha512-ZGDXefq1xknT292LnorMY5s8UVU08/WKdzDZCUT6t9JzsiMSP4uzUhgpqugffNVcT5WC6wMBiSQ+LFjlv3v7iQ==",
"dev": true
},
"deprecation": {
@ -13873,9 +13877,9 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
},
"prettier": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz",
"integrity": "sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==",
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"dev": true
},
"pretty-bytes": {
@ -15478,9 +15482,9 @@
}
},
"resin-lint": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/resin-lint/-/resin-lint-3.0.4.tgz",
"integrity": "sha512-TVxY7SaJqQRZcLubJn5yO49db/M4eRXRr7FbA4xwqSYxQSqujNql8ThMoNMoRrx+1F7NrfSdhIsLEaMqCea4VA==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/resin-lint/-/resin-lint-3.1.1.tgz",
"integrity": "sha512-BgIsrj9fvWcELoqfiu0dGflqkysByn7m/XVgbv19YdnnVToEtyQkFzfF9oY+h6nnr45pRYkorE6NAFYaVaYhLQ==",
"dev": true,
"requires": {
"@types/bluebird": "^3.5.26",
@ -15488,7 +15492,7 @@
"@types/glob": "^5.0.35",
"@types/node": "^8.10.45",
"@types/optimist": "0.0.29",
"@types/prettier": "^1.16.1",
"@types/prettier": "^1.18.3",
"bluebird": "^3.5.4",
"coffee-script": "^1.10.0",
"coffeelint": "^1.15.0",
@ -15497,7 +15501,7 @@
"glob": "^7.0.3",
"merge": "^1.2.0",
"optimist": "^0.6.1",
"prettier": "^1.16.4",
"prettier": "^1.19.1",
"tslint": "^5.15.0",
"tslint-config-prettier": "^1.18.0",
"tslint-no-unused-expression-chai": "^0.1.4",
@ -15505,9 +15509,9 @@
},
"dependencies": {
"@types/bluebird": {
"version": "3.5.27",
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.27.tgz",
"integrity": "sha512-6BmYWSBea18+tSjjSC3QIyV93ZKAeNWGM7R6aYt1ryTZXrlHF+QLV0G2yV0viEGVyRkyQsWfMoJ0k/YghBX5sQ==",
"version": "3.5.29",
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.29.tgz",
"integrity": "sha512-kmVtnxTuUuhCET669irqQmPAez4KFnFVKvpleVRyfC3g+SHD1hIkFZcWLim9BVcwUBLO59o8VZE4yGCmTif8Yw==",
"dev": true
},
"@types/glob": {
@ -15522,15 +15526,9 @@
}
},
"@types/node": {
"version": "8.10.49",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.49.tgz",
"integrity": "sha512-YX30JVx0PvSmJ3Eqr74fYLGeBxD+C7vIL20ek+GGGLJeUbVYRUW3EzyAXpIRA0K8c8o0UWqR/GwEFYiFoz1T8w==",
"dev": true
},
"coffee-script": {
"version": "1.12.7",
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz",
"integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==",
"version": "8.10.59",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.59.tgz",
"integrity": "sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ==",
"dev": true
}
}
@ -17141,16 +17139,16 @@
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
},
"tslint": {
"version": "5.18.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.18.0.tgz",
"integrity": "sha512-Q3kXkuDEijQ37nXZZLKErssQVnwCV/+23gFEMROi8IlbaBG6tXqLPQJ5Wjcyt/yHPKBC+hD5SzuGaMora+ZS6w==",
"version": "5.20.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"builtin-modules": "^1.1.1",
"chalk": "^2.3.0",
"commander": "^2.12.1",
"diff": "^3.2.0",
"diff": "^4.0.1",
"glob": "^7.1.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
@ -17162,15 +17160,9 @@
},
"dependencies": {
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"dev": true
},
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"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
}
}
@ -17191,9 +17183,9 @@
},
"dependencies": {
"tsutils": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.14.0.tgz",
"integrity": "sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==",
"version": "3.17.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
"integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==",
"dev": true,
"requires": {
"tslib": "^1.8.1"

View File

@ -140,9 +140,9 @@
"nock": "^11.0.7",
"parse-link-header": "~1.0.1",
"pkg": "^4.4.0",
"prettier": "1.17.0",
"prettier": "^1.19.1",
"publish-release": "^1.6.0",
"resin-lint": "^3.0.1",
"resin-lint": "^3.1.1",
"rewire": "^3.0.2",
"sinon": "^7.4.1",
"ts-node": "^8.1.0",

View File

@ -45,9 +45,7 @@ export class NockMock {
nock.emitter.on('no match', this.handleUnexpectedRequest);
} else if (process.env.DEBUG) {
console.error(
`[debug] NockMock.constructor() instance count is ${
NockMock.instanceCount
}`,
`[debug] NockMock.constructor() instance count is ${NockMock.instanceCount}`,
);
}
NockMock.instanceCount += 1;