From d83a25f47e53b5fda9dbb2ae98ccb5b9583e88d1 Mon Sep 17 00:00:00 2001 From: Matthew Raymer <matthew.raymer@anomalistdesign.com> Date: Wed, 9 Apr 2025 07:17:21 +0000 Subject: [PATCH] chore: linted with auto-fix --- src/components/DataExportSection.vue | 41 ++++++++++--------- src/services/PlatformServiceFactory.ts | 6 +-- src/services/api.ts | 8 ++-- src/services/deepLinks.ts | 8 ++-- src/services/plan.ts | 12 +++--- .../platforms/CapacitorPlatformService.ts | 12 ++++-- .../platforms/ElectronPlatformService.ts | 10 +++-- .../platforms/PyWebViewPlatformService.ts | 10 +++-- src/services/platforms/WebPlatformService.ts | 26 +++++++----- 9 files changed, 77 insertions(+), 56 deletions(-) diff --git a/src/components/DataExportSection.vue b/src/components/DataExportSection.vue index a05d9a63..d07a91b5 100644 --- a/src/components/DataExportSection.vue +++ b/src/components/DataExportSection.vue @@ -1,16 +1,9 @@ -/** - * Data Export Section Component - * - * Provides UI and functionality for exporting user data and backing up identifier seeds. - * Includes buttons for seed backup and database export, with platform-specific download instructions. - * - * @component - * @displayName DataExportSection - * @example - * ```vue - * <DataExportSection :active-did="currentDid" /> - * ``` - */ +/** * Data Export Section Component * * Provides UI and functionality for +exporting user data and backing up identifier seeds. * Includes buttons for seed +backup and database export, with platform-specific download instructions. * * +@component * @displayName DataExportSection * @example * ```vue * +<DataExportSection :active-did="currentDid" /> +* ``` */ <template> <div @@ -42,17 +35,23 @@ > If no download happened yet, click again here to download now. </a> - <div class="mt-4" v-if="platformCapabilities.needsFileHandlingInstructions"> + <div v-if="platformCapabilities.needsFileHandlingInstructions" class="mt-4"> <p> After the download, you can save the file in your preferred storage location. </p> <ul> - <li v-if="platformCapabilities.isIOS" class="list-disc list-outside ml-4"> + <li + v-if="platformCapabilities.isIOS" + class="list-disc list-outside ml-4" + > On iOS: Choose "More..." and select a place in iCloud, or go "Back" and save to another location. </li> - <li v-if="platformCapabilities.isMobile && !platformCapabilities.isIOS" class="list-disc list-outside ml-4"> + <li + v-if="platformCapabilities.isMobile && !platformCapabilities.isIOS" + class="list-disc list-outside ml-4" + > On Android: Choose "Open" and then share <font-awesome icon="share-nodes" class="fa-fw" /> to your prefered place. @@ -68,7 +67,10 @@ import { NotificationIface } from "../constants/app"; import { db } from "../db/index"; import { logger } from "../utils/logger"; import { PlatformServiceFactory } from "../services/PlatformServiceFactory"; -import { PlatformService, PlatformCapabilities } from "../services/PlatformService"; +import { + PlatformService, + PlatformCapabilities, +} from "../services/PlatformService"; /** * @vue-component @@ -100,7 +102,8 @@ export default class DataExportSection extends Vue { /** * Platform service instance for platform-specific operations */ - private platformService: PlatformService = PlatformServiceFactory.getInstance(); + private platformService: PlatformService = + PlatformServiceFactory.getInstance(); /** * Platform capabilities for the current platform @@ -123,7 +126,7 @@ export default class DataExportSection extends Vue { * Exports the database to a JSON file * Uses platform-specific methods for saving the exported data * Shows success/error notifications to user - * + * * @throws {Error} If export fails * @emits {Notification} Success or error notification */ diff --git a/src/services/PlatformServiceFactory.ts b/src/services/PlatformServiceFactory.ts index 6dca11b8..f5e34fa2 100644 --- a/src/services/PlatformServiceFactory.ts +++ b/src/services/PlatformServiceFactory.ts @@ -7,14 +7,14 @@ import { PyWebViewPlatformService } from "./platforms/PyWebViewPlatformService"; /** * Factory class for creating platform-specific service implementations. * Implements the Singleton pattern to ensure only one instance of PlatformService exists. - * + * * The factory determines which platform implementation to use based on the VITE_PLATFORM * environment variable. Supported platforms are: * - capacitor: Mobile platform using Capacitor * - electron: Desktop platform using Electron * - pywebview: Python WebView implementation * - web: Default web platform (fallback) - * + * * @example * ```typescript * const platformService = PlatformServiceFactory.getInstance(); @@ -27,7 +27,7 @@ export class PlatformServiceFactory { /** * Gets or creates the singleton instance of PlatformService. * Creates the appropriate platform-specific implementation based on environment. - * + * * @returns {PlatformService} The singleton instance of PlatformService */ public static getInstance(): PlatformService { diff --git a/src/services/api.ts b/src/services/api.ts index 5869abf8..3235100e 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -1,7 +1,7 @@ /** * API error handling utilities for the application. * Provides centralized error handling for API requests with platform-specific logging. - * + * * @module api */ @@ -10,12 +10,12 @@ import { logger } from "../utils/logger"; /** * Handles API errors with platform-specific logging and error processing. - * + * * @param error - The Axios error object from the failed request * @param endpoint - The API endpoint that was called * @returns null for rate limit errors (400), throws the error otherwise * @throws The original error for non-rate-limit cases - * + * * @remarks * Special handling includes: * - Enhanced logging for Capacitor platform @@ -25,7 +25,7 @@ import { logger } from "../utils/logger"; * - HTTP status * - Response data * - Request configuration (URL, method, headers) - * + * * @example * ```typescript * try { diff --git a/src/services/deepLinks.ts b/src/services/deepLinks.ts index 4681019a..20e8cce0 100644 --- a/src/services/deepLinks.ts +++ b/src/services/deepLinks.ts @@ -25,7 +25,7 @@ * * Deep Link Format: * timesafari://<route>[/<param>][?queryParam1=value1&queryParam2=value2] - * + * * Supported Routes: * - user-profile: View user profile * - project-details: View project details @@ -73,7 +73,7 @@ export class DeepLinkHandler { /** * Parses deep link URL into path, params and query components. * Validates URL structure using Zod schemas. - * + * * @param url - The deep link URL to parse (format: scheme://path[?query]) * @throws {DeepLinkError} If URL format is invalid * @returns Parsed URL components (path, params, query) @@ -111,7 +111,7 @@ export class DeepLinkHandler { /** * Processes incoming deep links and routes them appropriately. * Handles validation, error handling, and routing to the correct view. - * + * * @param url - The deep link URL to process * @throws {DeepLinkError} If URL processing fails */ @@ -142,7 +142,7 @@ export class DeepLinkHandler { /** * Routes the deep link to appropriate view with validated parameters. * Validates route and parameters using Zod schemas before routing. - * + * * @param path - The route path from the deep link * @param params - URL parameters * @param query - Query string parameters diff --git a/src/services/plan.ts b/src/services/plan.ts index a730d63a..1419b22c 100644 --- a/src/services/plan.ts +++ b/src/services/plan.ts @@ -1,7 +1,7 @@ /** * Plan service module for handling plan and claim data loading. * Provides functionality to load plans with retry mechanism and error handling. - * + * * @module plan */ @@ -26,11 +26,11 @@ interface PlanResponse { /** * Loads a plan with automatic retry mechanism. * Attempts to load the plan multiple times in case of failure. - * + * * @param handle - The unique identifier for the plan or claim * @param retries - Number of retry attempts (default: 3) * @returns Promise resolving to PlanResponse - * + * * @remarks * - Implements exponential backoff with 1 second delay between retries * - Provides detailed logging of each attempt and any errors @@ -39,7 +39,7 @@ interface PlanResponse { * - HTTP status and headers * - Response data * - Request configuration - * + * * @example * ```typescript * const response = await loadPlanWithRetry('plan-123'); @@ -104,11 +104,11 @@ export const loadPlanWithRetry = async ( /** * Makes a single API request to load a plan or claim. * Determines the appropriate endpoint based on the handle. - * + * * @param handle - The unique identifier for the plan or claim * @returns Promise resolving to PlanResponse * @throws Will throw an error if the API request fails - * + * * @remarks * - Automatically detects claim vs plan endpoints based on handle * - Uses axios for HTTP requests diff --git a/src/services/platforms/CapacitorPlatformService.ts b/src/services/platforms/CapacitorPlatformService.ts index b5fcd81e..c416ddb4 100644 --- a/src/services/platforms/CapacitorPlatformService.ts +++ b/src/services/platforms/CapacitorPlatformService.ts @@ -1,4 +1,8 @@ -import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService"; +import { + ImageResult, + PlatformService, + PlatformCapabilities, +} from "../PlatformService"; import { Filesystem, Directory } from "@capacitor/filesystem"; import { Camera, CameraResultType, CameraSource } from "@capacitor/camera"; import { logger } from "../../utils/logger"; @@ -22,7 +26,7 @@ export class CapacitorPlatformService implements PlatformService { isMobile: true, isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent), hasFileDownload: false, - needsFileHandlingInstructions: true + needsFileHandlingInstructions: true, }; } @@ -80,7 +84,9 @@ export class CapacitorPlatformService implements PlatformService { path: directory, directory: Directory.Data, }); - return result.files.map(file => typeof file === 'string' ? file : file.name); + return result.files.map((file) => + typeof file === "string" ? file : file.name, + ); } /** diff --git a/src/services/platforms/ElectronPlatformService.ts b/src/services/platforms/ElectronPlatformService.ts index 86725881..74fc8290 100644 --- a/src/services/platforms/ElectronPlatformService.ts +++ b/src/services/platforms/ElectronPlatformService.ts @@ -1,11 +1,15 @@ -import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService"; +import { + ImageResult, + PlatformService, + PlatformCapabilities, +} from "../PlatformService"; import { logger } from "../../utils/logger"; /** * Platform service implementation for Electron (desktop) platform. * Note: This is a placeholder implementation with most methods currently unimplemented. * Implements the PlatformService interface but throws "Not implemented" errors for most operations. - * + * * @remarks * This service is intended for desktop application functionality through Electron. * Future implementations should provide: @@ -25,7 +29,7 @@ export class ElectronPlatformService implements PlatformService { isMobile: false, isIOS: false, hasFileDownload: false, // Not implemented yet - needsFileHandlingInstructions: false + needsFileHandlingInstructions: false, }; } diff --git a/src/services/platforms/PyWebViewPlatformService.ts b/src/services/platforms/PyWebViewPlatformService.ts index 7cd5fd53..b27aec31 100644 --- a/src/services/platforms/PyWebViewPlatformService.ts +++ b/src/services/platforms/PyWebViewPlatformService.ts @@ -1,11 +1,15 @@ -import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService"; +import { + ImageResult, + PlatformService, + PlatformCapabilities, +} from "../PlatformService"; import { logger } from "../../utils/logger"; /** * Platform service implementation for PyWebView platform. * Note: This is a placeholder implementation with most methods currently unimplemented. * Implements the PlatformService interface but throws "Not implemented" errors for most operations. - * + * * @remarks * This service is intended for Python-based desktop applications using pywebview. * Future implementations should provide: @@ -26,7 +30,7 @@ export class PyWebViewPlatformService implements PlatformService { isMobile: false, isIOS: false, hasFileDownload: false, // Not implemented yet - needsFileHandlingInstructions: false + needsFileHandlingInstructions: false, }; } diff --git a/src/services/platforms/WebPlatformService.ts b/src/services/platforms/WebPlatformService.ts index bcfdfec1..8b911a92 100644 --- a/src/services/platforms/WebPlatformService.ts +++ b/src/services/platforms/WebPlatformService.ts @@ -1,16 +1,20 @@ -import { ImageResult, PlatformService, PlatformCapabilities } from "../PlatformService"; +import { + ImageResult, + PlatformService, + PlatformCapabilities, +} from "../PlatformService"; import { logger } from "../../utils/logger"; /** * Platform service implementation for web browser platform. * Implements the PlatformService interface with web-specific functionality. - * + * * @remarks * This service provides web-based implementations for: * - Image capture using the browser's file input * - Image selection from local filesystem * - Image processing and conversion - * + * * Note: File system operations are not available in the web platform * due to browser security restrictions. These methods throw appropriate errors. */ @@ -26,7 +30,7 @@ export class WebPlatformService implements PlatformService { isMobile: /iPhone|iPad|iPod|Android/i.test(navigator.userAgent), isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent), hasFileDownload: true, - needsFileHandlingInstructions: false + needsFileHandlingInstructions: false, }; } @@ -70,10 +74,10 @@ export class WebPlatformService implements PlatformService { /** * Opens a file input dialog configured for camera capture. * Creates a temporary file input element to access the device camera. - * + * * @returns Promise resolving to the captured image data * @throws Error if image capture fails or no image is selected - * + * * @remarks * Uses the 'capture' attribute to prefer the device camera. * Falls back to file selection if camera is not available. @@ -111,10 +115,10 @@ export class WebPlatformService implements PlatformService { /** * Opens a file input dialog for selecting an image file. * Creates a temporary file input element to access local files. - * + * * @returns Promise resolving to the selected image data * @throws Error if image processing fails or no image is selected - * + * * @remarks * Allows selection of any image file type. * Processes the selected image to ensure consistent format. @@ -150,11 +154,11 @@ export class WebPlatformService implements PlatformService { /** * Processes an image file to ensure consistent format. * Converts the file to a data URL and then to a Blob. - * + * * @param file - The image File object to process * @returns Promise resolving to processed image Blob * @throws Error if file reading or conversion fails - * + * * @remarks * This method ensures consistent image format across different * input sources by converting through data URL to Blob. @@ -216,7 +220,7 @@ export class WebPlatformService implements PlatformService { /** * Handles deep link URLs in the web platform. * Deep links are handled through URL parameters in the web environment. - * + * * @param _url - The deep link URL to handle (unused in web implementation) * @returns Promise that resolves immediately as web handles URLs naturally */