diff --git a/cli/.prettierrc b/cli/.prettierrc index 7cebf3813c..cde9f154ce 100644 --- a/cli/.prettierrc +++ b/cli/.prettierrc @@ -2,5 +2,7 @@ "singleQuote": true, "trailingComma": "all", "printWidth": 120, - "semi": true + "semi": true, + "plugins": ["prettier-plugin-organize-imports"], + "organizeImportsSkipDestructiveCodeActions": true } diff --git a/cli/package-lock.json b/cli/package-lock.json index 39425c37d9..fe7abb8586 100644 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -31,6 +31,8 @@ "glob": "^10.3.1", "immich": "file:../server", "mock-fs": "^5.2.0", + "prettier": "^3.2.5", + "prettier-plugin-organize-imports": "^3.2.4", "typescript": "^5.3.3", "vite": "^5.0.12", "vitest": "^1.2.2", @@ -4068,11 +4070,10 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -4095,6 +4096,26 @@ "node": ">=6.0.0" } }, + "node_modules/prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "peerDependencies": { + "@volar/vue-language-plugin-pug": "^1.0.4", + "@volar/vue-typescript": "^1.0.4", + "prettier": ">=2.0", + "typescript": ">=2.9" + }, + "peerDependenciesMeta": { + "@volar/vue-language-plugin-pug": { + "optional": true + }, + "@volar/vue-typescript": { + "optional": true + } + } + }, "node_modules/pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", @@ -8543,11 +8564,10 @@ "dev": true }, "prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", - "dev": true, - "peer": true + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true }, "prettier-linter-helpers": { "version": "1.0.0", @@ -8558,6 +8578,13 @@ "fast-diff": "^1.1.2" } }, + "prettier-plugin-organize-imports": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.4.tgz", + "integrity": "sha512-6m8WBhIp0dfwu0SkgfOxJqh+HpdyfqSSLfKKRZSFbDuEQXDDndb8fTpRWkUrX/uBenkex3MgnVk0J3b3Y5byog==", + "dev": true, + "requires": {} + }, "pretty-format": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", diff --git a/cli/package.json b/cli/package.json index c5a90057c0..8bb00f9cfe 100644 --- a/cli/package.json +++ b/cli/package.json @@ -32,6 +32,8 @@ "glob": "^10.3.1", "immich": "file:../server", "mock-fs": "^5.2.0", + "prettier": "^3.2.5", + "prettier-plugin-organize-imports": "^3.2.4", "typescript": "^5.3.3", "vite": "^5.0.12", "vitest": "^1.2.2", diff --git a/cli/src/commands/base-command.ts b/cli/src/commands/base-command.ts index cc76f4a7ea..2ecb3fef2d 100644 --- a/cli/src/commands/base-command.ts +++ b/cli/src/commands/base-command.ts @@ -1,6 +1,6 @@ import { ServerVersionResponseDto, UserResponseDto } from '@immich/sdk'; -import { SessionService } from '../services/session.service'; import { ImmichApi } from 'src/services/api.service'; +import { SessionService } from '../services/session.service'; export abstract class BaseCommand { protected sessionService!: SessionService; diff --git a/cli/src/commands/upload.command.ts b/cli/src/commands/upload.command.ts index f26f297a29..fbd228fe81 100644 --- a/cli/src/commands/upload.command.ts +++ b/cli/src/commands/upload.command.ts @@ -1,13 +1,13 @@ import byteSize from 'byte-size'; import cliProgress from 'cli-progress'; +import { createHash } from 'node:crypto'; import fs, { createReadStream } from 'node:fs'; +import { access, constants, stat, unlink } from 'node:fs/promises'; +import os from 'node:os'; +import { basename } from 'node:path'; +import { ImmichApi } from 'src/services/api.service'; import { CrawlService } from '../services/crawl.service'; import { BaseCommand } from './base-command'; -import { basename } from 'node:path'; -import { access, constants, stat, unlink } from 'node:fs/promises'; -import { createHash } from 'node:crypto'; -import os from 'node:os'; -import { ImmichApi } from 'src/services/api.service'; class Asset { readonly path: string; diff --git a/cli/src/index.ts b/cli/src/index.ts index eead2b0272..35edc1fdf2 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -1,7 +1,7 @@ #! /usr/bin/env node import { Command, Option } from 'commander'; -import path from 'node:path'; import os from 'node:os'; +import path from 'node:path'; import { version } from '../package.json'; import { LoginCommand } from './commands/login.command'; import { LogoutCommand } from './commands/logout.command'; diff --git a/cli/src/services/api.service.ts b/cli/src/services/api.service.ts index ef76a75441..089eda1201 100644 --- a/cli/src/services/api.service.ts +++ b/cli/src/services/api.service.ts @@ -1,4 +1,11 @@ import { + ApiKeyCreateDto, + AssetBulkUploadCheckDto, + BulkIdsDto, + CreateAlbumDto, + CreateAssetDto, + LoginCredentialDto, + SignUpDto, addAssetsToAlbum, checkBulkUpload, createAlbum, @@ -13,13 +20,6 @@ import { pingServer, signUpAdmin, uploadFile, - ApiKeyCreateDto, - AssetBulkUploadCheckDto, - BulkIdsDto, - CreateAlbumDto, - CreateAssetDto, - LoginCredentialDto, - SignUpDto, } from '@immich/sdk'; /** diff --git a/cli/src/services/crawl.service.spec.ts b/cli/src/services/crawl.service.spec.ts index 003935944a..93879f21e0 100644 --- a/cli/src/services/crawl.service.spec.ts +++ b/cli/src/services/crawl.service.spec.ts @@ -1,5 +1,5 @@ import mockfs from 'mock-fs'; -import { CrawlService, CrawlOptions } from './crawl.service'; +import { CrawlOptions, CrawlService } from './crawl.service'; interface Test { test: string; diff --git a/cli/src/services/session.service.spec.ts b/cli/src/services/session.service.spec.ts index f6ef709bfc..56967fa812 100644 --- a/cli/src/services/session.service.spec.ts +++ b/cli/src/services/session.service.spec.ts @@ -1,4 +1,3 @@ -import { SessionService } from './session.service'; import fs from 'node:fs'; import yaml from 'yaml'; import { @@ -11,6 +10,7 @@ import { readTestAuthFile, spyOnConsole, } from '../../test/cli-test-utils'; +import { SessionService } from './session.service'; const mocks = vi.hoisted(() => { return { diff --git a/cli/test/e2e/login-key.e2e-spec.ts b/cli/test/e2e/login-key.e2e-spec.ts index acbce5c244..679d510002 100644 --- a/cli/test/e2e/login-key.e2e-spec.ts +++ b/cli/test/e2e/login-key.e2e-spec.ts @@ -1,8 +1,8 @@ import { restoreTempFolder, testApp } from '@test-utils'; -import { CLI_BASE_OPTIONS, TEST_AUTH_FILE, deleteAuthFile, setup, spyOnConsole } from 'test/cli-test-utils'; import { readFile, stat } from 'node:fs/promises'; -import { LoginCommand } from '../../src/commands/login.command'; +import { CLI_BASE_OPTIONS, TEST_AUTH_FILE, deleteAuthFile, setup, spyOnConsole } from 'test/cli-test-utils'; import yaml from 'yaml'; +import { LoginCommand } from '../../src/commands/login.command'; describe(`login-key (e2e)`, () => { let apiKey: string; diff --git a/cli/test/e2e/setup.ts b/cli/test/e2e/setup.ts index fb1d939eba..f51976aa7a 100644 --- a/cli/test/e2e/setup.ts +++ b/cli/test/e2e/setup.ts @@ -1,6 +1,6 @@ -import path from 'node:path'; import { PostgreSqlContainer } from '@testcontainers/postgresql'; import { access } from 'node:fs/promises'; +import path from 'node:path'; export const directoryExists = (directory: string) => access(directory) diff --git a/cli/test/e2e/upload.e2e-spec.ts b/cli/test/e2e/upload.e2e-spec.ts index 81b20ad749..4c4bf10739 100644 --- a/cli/test/e2e/upload.e2e-spec.ts +++ b/cli/test/e2e/upload.e2e-spec.ts @@ -1,7 +1,7 @@ import { IMMICH_TEST_ASSET_PATH, restoreTempFolder, testApp } from '@test-utils'; +import { ImmichApi } from 'src/services/api.service'; import { CLI_BASE_OPTIONS, setup, spyOnConsole } from 'test/cli-test-utils'; import { UploadCommand } from '../../src/commands/upload.command'; -import { ImmichApi } from 'src/services/api.service'; describe(`upload (e2e)`, () => { let api: ImmichApi;