chore(deps): update dependency eslint-plugin-unicorn to v70 - abandoned (#29684)

* chore(deps): update dependency eslint-plugin-unicorn to v70

* fix: linting

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
renovate[bot] 2026-07-20 23:47:14 -04:00 committed by GitHub
parent 8061a2e5ff
commit df970da59e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
266 changed files with 1260 additions and 1212 deletions

View file

@ -30,8 +30,8 @@ export class AssetExifFactory {
focalLength: 4.38,
fps: null,
iso: 947,
latitude: 30.267_334_570_570_195,
longitude: -97.789_833_534_282_07,
latitude: 30.267334570570195,
longitude: -97.78983353428207,
lensModel: null,
livePhotoCID: null,
make: 'Google',

View file

@ -502,7 +502,7 @@ export const eiffelTower = {
profile: H264Profile.High,
level: 40,
frameCount: 557,
frameRate: 24.908_004_845_459_07,
frameRate: 24.90800484545907,
timeBase: 90_000,
bitrate: 5_128_622,
pixelFormat: 'yuv420p',
@ -541,7 +541,7 @@ export const waterfall = {
profile: HevcProfile.Main,
level: 156,
frameCount: 309,
frameRate: 29.829_901_982_867_92,
frameRate: 29.82990198286792,
timeBase: 90_000,
bitrate: 43_363_499,
pixelFormat: 'yuvj420p',
@ -582,7 +582,7 @@ export const train = {
profile: HevcProfile.Main10,
level: 123,
frameCount: 1229,
frameRate: 56.536_072_989_342_94,
frameRate: 56.53607298934294,
timeBase: 600,
bitrate: 12_595_191,
pixelFormat: 'yuv420p10le',

View file

@ -1,3 +1,4 @@
import { DateTime } from 'luxon';
import { MapAsset } from 'src/dtos/asset-response.dto';
import { SharedLinkType } from 'src/enum';
import { AssetFactory } from 'test/factories/asset.factory';
@ -5,10 +6,8 @@ import { authStub } from 'test/fixtures/auth.stub';
import { userStub } from 'test/fixtures/user.stub';
const today = new Date();
const tomorrow = new Date();
const yesterday = new Date();
tomorrow.setDate(today.getDate() + 1);
yesterday.setDate(yesterday.getDate() - 1);
const tomorrow = DateTime.now().plus({ days: 1 }).toJSDate();
const yesterday = DateTime.now().minus({ days: 1 }).toJSDate();
const sharedLinkBytes = Buffer.from(
'2c2b646895f84753bff43fb696ad124f3b0faf2a0bd547406f26fa4a76b5c71990092baa536275654b2ab7a191fb21a6d6cd',

View file

@ -68,7 +68,6 @@ export const getDehydrated = <T extends Record<string, unknown>>(entity: T) => {
for (const [key, value] of Object.entries(copiedEntity)) {
if (value instanceof Date) {
Object.assign(copiedEntity, { [key]: value.toISOString() });
continue;
}
}

View file

@ -138,7 +138,7 @@ export class MediumTestContext<S extends BaseService = BaseService> {
}
get<T>(key: ClassConstructor<T>): T {
if (!this.repoCache[key.name]) {
if (!Object.hasOwn(this.repoCache, key.name)) {
const real = newRealRepository(key, this.options.database);
this.repoCache[key.name] = real;
}
@ -313,11 +313,11 @@ export class SyncTestContext extends MediumTestContext<SyncService> {
});
}
async syncStream(auth: AuthDto, types: SyncRequestType[], reset?: boolean) {
async syncStream(auth: AuthDto, types: SyncRequestType[], shouldReset?: boolean) {
const stream = mediumFactory.syncStream();
// Wait for 2ms to ensure all updates are available and account for setTimeout inaccuracy
await wait(2);
await this.sut.stream(auth, stream, { types, reset });
await this.sut.stream(auth, stream, { types, reset: shouldReset });
return stream.getResponse();
}
@ -750,6 +750,8 @@ const tagInsert = (tag: Partial<Insertable<TagTable>>) => {
class CustomWritable extends Writable {
private data = '';
// determined by Writable interface
// eslint-disable-next-line unicorn/prefer-private-class-fields
_write(chunk: any, encoding: string, callback: () => void) {
this.data += chunk.toString();
callback();

View file

@ -8,11 +8,7 @@ import { newMediumService } from 'test/medium.factory';
import { getKyselyDB } from 'test/utils';
const consume = async <T>(generator: AsyncIterableIterator<T>) => {
const values: T[] = [];
for await (const value of generator) {
values.push(value);
}
const values: T[] = await Array.fromAsync(generator);
return values;
};

View file

@ -184,6 +184,7 @@ describe(TimelineService.name, () => {
await ctx.newExif({ assetId: result.asset.id, make: 'Canon' });
return result;
}),
ctx.newUser().then(async ({ user }) => {
const result = await ctx.newAsset({
ownerId: user.id,

View file

@ -126,8 +126,8 @@ describe(UserService.name, () => {
const after = await sut.setLicense(auth, license);
expect(after.licenseKey).toEqual(license.licenseKey);
expect(after.activationKey).toEqual(license.activationKey);
const getResponse = await sut.getLicense(auth);
expect(getResponse).toEqual(after);
const response = await sut.getLicense(auth);
expect(response).toEqual(after);
});
});

View file

@ -4,7 +4,7 @@ import { SYNC_TYPES_ORDER } from 'src/services/sync.service';
describe('types', () => {
it('should have all the types in the ordering variable', () => {
for (const key in SyncRequestType) {
expect(SYNC_TYPES_ORDER).includes(key);
expect(SYNC_TYPES_ORDER.includes(key as SyncRequestType)).toBe(true);
}
expect(SYNC_TYPES_ORDER.length).toBe(Object.keys(SyncRequestType).length);

View file

@ -21,7 +21,7 @@ import { MediumTestContext } from 'test/medium.factory';
import { mockEnvData } from 'test/repositories/config.repository.mock';
import { getKyselyDB } from 'test/utils';
let initialized = false;
let isInitialized = false;
class WorkflowTestContext extends MediumTestContext<WorkflowExecutionService> {
constructor(database: Kysely<DB>) {
@ -44,7 +44,7 @@ class WorkflowTestContext extends MediumTestContext<WorkflowExecutionService> {
}
async init() {
if (initialized) {
if (isInitialized) {
return;
}
@ -57,7 +57,7 @@ class WorkflowTestContext extends MediumTestContext<WorkflowExecutionService> {
await this.sut.onPluginSync();
await this.sut.onPluginLoad();
initialized = true;
isInitialized = true;
}
}
@ -337,7 +337,7 @@ describe('core plugin', () => {
it('should favorite an asset within a given radius', async () => {
const { user } = await ctx.newUser();
const { asset } = await ctx.newAsset({ ownerId: user.id });
await ctx.newExif({ assetId: asset.id, latitude: 49.273_353_221_145_36, longitude: -123.103_871_440_787_64 });
await ctx.newExif({ assetId: asset.id, latitude: 49.27335322114536, longitude: -123.10387144078764 });
const workflow = await createWorkflow({
ownerId: user.id,
@ -345,7 +345,7 @@ describe('core plugin', () => {
steps: [
{
method: 'immich-plugin-core#assetLocationFilter',
config: { coordinate: { latitude: 49.288_821_679_949_29, longitude: -123.111_153_098_813_7, radius: 2 } },
config: { coordinate: { latitude: 49.28882167994929, longitude: -123.1111530988137, radius: 2 } },
},
{
method: 'immich-plugin-core#assetFavorite',
@ -360,7 +360,7 @@ describe('core plugin', () => {
it('should not favorite asset outside a given radius', async () => {
const { user } = await ctx.newUser();
const { asset } = await ctx.newAsset({ ownerId: user.id });
await ctx.newExif({ assetId: asset.id, latitude: 49.261_266_052_570_35, longitude: -123.248_959_390_781_96 });
await ctx.newExif({ assetId: asset.id, latitude: 49.26126605257035, longitude: -123.24895939078196 });
const workflow = await createWorkflow({
ownerId: user.id,
@ -368,7 +368,7 @@ describe('core plugin', () => {
steps: [
{
method: 'immich-plugin-core#assetLocationFilter',
config: { coordinate: { latitude: 49.288_821_679_949_29, longitude: -123.111_153_098_813_7, radius: 10 } },
config: { coordinate: { latitude: 49.28882167994929, longitude: -123.1111530988137, radius: 10 } },
},
{
method: 'immich-plugin-core#assetFavorite',

View file

@ -13,7 +13,7 @@ export const makeMockWatcher =
({ items, close }: MockWatcherOptions) =>
(paths: string[], options: ChokidarOptions, events: Partial<WatchEvents>) => {
events.onReady?.();
for (const item of items || []) {
for (const item of items ?? []) {
switch (item.event) {
case 'add': {
events.onAdd?.(item.value);

View file

@ -6,17 +6,12 @@ import { v4, v7 } from 'uuid';
import { expect } from 'vitest';
export const newUuid = () => v4();
export const newUuids = () =>
Array.from({ length: 100 })
.fill(0)
.map(() => newUuid());
export const newUuids = () => Array.from({ length: 100 }, () => 0).map(() => newUuid());
export const newDate = () => new Date();
export const newUuidV7 = () => v7();
export const newSha1 = () => Buffer.from('this is a fake hash');
export const newEmbedding = () => {
const embedding = Array.from({ length: 512 })
.fill(0)
.map(() => Math.random());
const embedding = Array.from({ length: 512 }, () => 0).map(() => Math.random());
return '[' + embedding + ']';
};

View file

@ -1,3 +1,4 @@
/* eslint-disable unicorn/no-this-outside-of-class */
import { createPostgres, DatabaseConnectionParams } from '@immich/sql-tools';
import { CallHandler, ExecutionContext, Provider } from '@nestjs/common';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
@ -107,6 +108,7 @@ export const controllerSetup = async (controller: new (...args: any[]) => unknow
await new Promise<void>((resolve, reject) => {
const next: NextFunction = (error) => (error ? reject(transformException(error)) : resolve());
const maybePromise = handler(context.getRequest(), context.getResponse(), next);
Promise.resolve(maybePromise).catch((error) => reject(error));
});
@ -176,7 +178,7 @@ export const automock = <T>(
},
): AutoMocked<T> => {
const mock: Record<string, unknown> = {};
const strict = options?.strict ?? true;
const isStrict = options?.strict ?? true;
const args = options?.args ?? [];
const mocks: Mock[] = [];
@ -197,7 +199,7 @@ export const automock = <T>(
const target = instance[property as keyof T];
if (typeof target === 'function') {
const mockImplementation = mockFn(label, { strict });
const mockImplementation = mockFn(label, { strict: isStrict });
mock[property] = mockImplementation;
mocks.push(mockImplementation);
continue;
@ -454,7 +456,7 @@ const pngFactory = newPngFactory();
const templateName = 'mich';
const withDatabase = (url: string, name: string) => url.replace(`/${templateName}`, `/${name}`);
const withDatabase = (url: string, name: string) => url.replace(`/${templateName}`, () => `/${name}`);
export const getKyselyDB = async (suffix?: string): Promise<Kysely<DB>> => {
const testUrl = process.env.IMMICH_TEST_POSTGRES_URL!;