Skip to content

Commit

Permalink
Update @balena/lint to 8.2.7
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Jul 19, 2024
1 parent e01c1f5 commit 47ba44c
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 106 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"node": ">=18.0"
},
"devDependencies": {
"@balena/lint": "^7.3.0",
"@balena/lint": "^8.2.7",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.4",
"@types/lodash": "^4.14.195",
Expand Down
4 changes: 2 additions & 2 deletions src/models/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const getApplicationModel = function (
);

// Infer dashboardUrl from apiUrl if former is undefined
const dashboardUrl = opts.dashboardUrl ?? apiUrl!.replace(/api/, 'dashboard');
const dashboardUrl = opts.dashboardUrl ?? apiUrl.replace(/api/, 'dashboard');

// Internal method for name/id disambiguation
// Note that this throws an exception for missing names, but not missing ids
Expand Down Expand Up @@ -493,7 +493,7 @@ const getApplicationModel = function (
)) as Application & {
owns__device: Array<DeviceWithServiceDetails<CurrentServiceWithCommit>>;
};
if (app && app.owns__device) {
if (app?.owns__device) {
app.owns__device = app.owns__device.map((d) =>
generateCurrentServiceDetails<CurrentServiceWithCommit>(d),
);
Expand Down
2 changes: 1 addition & 1 deletion src/models/device-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ const getDeviceTypeModel = function (deps: InjectedDependenciesParam) {
$select: 'contract',
},
));
if (!contract || !contract.partials) {
if (!contract?.partials) {
throw new Error(
`Instruction partials not defined for ${deviceTypeSlugOrContract}`,
);
Expand Down
6 changes: 3 additions & 3 deletions src/models/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const getDeviceModel = function (
);

// Infer dashboardUrl from apiUrl if former is undefined
const dashboardUrl = opts.dashboardUrl ?? apiUrl!.replace(/api/, 'dashboard');
const dashboardUrl = opts.dashboardUrl ?? apiUrl.replace(/api/, 'dashboard');

const getDeviceUrlsBase = once(async function () {
if (deviceUrlsBase != null) {
Expand Down Expand Up @@ -1413,7 +1413,7 @@ const getDeviceModel = function (
uuid,
deviceType: (deviceType ?? application.is_for__device_type[0]).slug,
provisioningApiKey: apiKey,
apiEndpoint: apiUrl!,
apiEndpoint: apiUrl,
});
},

Expand Down Expand Up @@ -1601,7 +1601,7 @@ const getDeviceModel = function (
];
const device = await exports.get(uuidOrId, { $select: selectedProps });
checkLocalModeSupported(device);
return await exports.configVar.set(device.id, LOCAL_MODE_ENV_VAR, '1');
await exports.configVar.set(device.id, LOCAL_MODE_ENV_VAR, '1');
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/models/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getImageModel = function (deps: InjectedDependenciesParam) {
// TODO: Mark the build_log as explicitRead in the next API model version
// so that we can remove this & the explicit property selection from here.
true,
) as typeof baseOptions,
),
});
if (image == null) {
throw new errors.BalenaImageNotFound(id);
Expand Down
12 changes: 6 additions & 6 deletions src/models/os.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const getOsModel = function (
options?.includeDraft === true ? 'include_draft' : 'supported',
);
return singleDeviceTypeArg
? versionsByDt[singleDeviceTypeArg] ?? []
? (versionsByDt[singleDeviceTypeArg] ?? [])
: versionsByDt;
}

Expand Down Expand Up @@ -469,7 +469,7 @@ const getOsModel = function (
: await _getAllOsVersions(deviceTypes, options)
) as Dictionary<Array<ExtendedPineTypedResult<Release, OsVersion, TP>>>;
return singleDeviceTypeArg
? versionsByDt[singleDeviceTypeArg] ?? []
? (versionsByDt[singleDeviceTypeArg] ?? [])
: versionsByDt;
}

Expand Down Expand Up @@ -530,7 +530,7 @@ const getOsModel = function (
if (v === 'latest') {
return v;
}
const vNormalized = v[0] === 'v' ? v.substring(1) : v;
const vNormalized = v.startsWith('v') ? v.substring(1) : v;
// We still don't want to allow `balenaOS` prefixes, which balena-semver allows.
if (!bSemver.valid(vNormalized) || !/^\d/.test(vNormalized)) {
throw new Error(`Invalid semver version: ${v}`);
Expand Down Expand Up @@ -596,7 +596,7 @@ const getOsModel = function (
*/
const getDownloadSize = async function (
deviceType: string,
version: string = 'latest',
version = 'latest',
): Promise<number> {
deviceType = await _getNormalizedDeviceTypeSlug(deviceType);
return await _getDownloadSize(deviceType, version);
Expand Down Expand Up @@ -636,7 +636,7 @@ const getOsModel = function (
*/
const getMaxSatisfyingVersion = async function (
deviceType: string,
versionOrRange: string = 'latest',
versionOrRange = 'latest',
osType?: 'default' | 'esr',
): Promise<string | null> {
deviceType = await _getNormalizedDeviceTypeSlug(deviceType);
Expand Down Expand Up @@ -673,7 +673,7 @@ const getOsModel = function (
*/
const getLastModified = async function (
deviceType: string,
version: string = 'latest',
version = 'latest',
): Promise<Date> {
try {
deviceType = await _getNormalizedDeviceTypeSlug(deviceType);
Expand Down
5 changes: 1 addition & 4 deletions src/models/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ const getReleaseModel = function (
$expand: {
release_image: {
$expand: {
image: mergePineOptions(
baseImageOptions,
options.image,
) as typeof baseImageOptions,
image: mergePineOptions(baseImageOptions, options.image),
},
},
is_created_by__user: {
Expand Down
2 changes: 1 addition & 1 deletion src/util/dependent-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function buildDependentResource<T extends DependentResource>(
): Promise<void> {
const parentId = await getResourceId(parentParam);
await pine.delete({
resource: `${resourceName}`,
resource: resourceName,
options: {
$filter: {
[parentResourceName]: parentId,
Expand Down
11 changes: 5 additions & 6 deletions src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function mergePineOptionsTyped<
R extends object,
P extends Pine.ODataOptionsStrict<R>,
>(defaults: P, extras: Pine.ODataOptions<R> | undefined): P {
return mergePineOptions(defaults, extras) as P;
return mergePineOptions(defaults, extras);
}

export type ExtendedPineTypedResult<
Expand Down Expand Up @@ -273,7 +273,7 @@ const convertExpandToObject = <T extends object>(
}

if (cloneIfNeeded) {
return { ...(expandOption as Pine.ResourceExpand<T>) };
return { ...expandOption };
}

return expandOption;
Expand Down Expand Up @@ -331,8 +331,8 @@ export const limitedMap = <T, U>(
try {
inFlight++;
result[i] = await fn(arr[i], i, arr);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
runNext();

void runNext();
} catch (err) {
// Stop any further iterations
idx = arr.length;
Expand All @@ -347,8 +347,7 @@ export const limitedMap = <T, U>(
}
};
while (inFlight < concurrency) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
runNext();
void runNext();
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/application-membership.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ describe('Application Membership Model', function () {
username: ctx.username,
});
// @ts-expect-error Fix the return types of all create methods to be fully typed
ctx.userId = membership!.user.__id;
ctx.userId = membership.user.__id;
});

after(async function () {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/models/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ describe('Application Model', function () {
return balena.models.application
.getWithDeviceServiceDetails(this.application.id)
.then((applicationDetails) => {
return itShouldBeAnApplicationWithDeviceServiceDetails.call(
itShouldBeAnApplicationWithDeviceServiceDetails.call(
this,
applicationDetails,
true,
Expand Down Expand Up @@ -1625,7 +1625,7 @@ describe('Application Model', function () {
extraServiceDetailOptions,
)
.then((applicationDetails) => {
return itShouldBeAnApplicationWithDeviceServiceDetails.call(
itShouldBeAnApplicationWithDeviceServiceDetails.call(
this,
applicationDetails,
true,
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/models/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ describe('Config Model', function () {

describe('balena.models.config.getDeviceTypes()', function () {
it('should become the device types', function () {
return balena.models.config
.getDeviceTypes()
.then((deviceTypes) => expectDeviceTypeArray(deviceTypes));
return balena.models.config.getDeviceTypes().then((deviceTypes) => {
expectDeviceTypeArray(deviceTypes);
});
});

describe('device type normalization', function () {
Expand Down
Loading

0 comments on commit 47ba44c

Please sign in to comment.