Commit Graph

6454 Commits

Author SHA1 Message Date
Johnpaul
fd8118564a refactor: remove 'as any' assertions from test files (batch 1: 16 files)
- Fixed 15 as any type assertions across 16 test files
- Used proper TypeScript types: unknown, Settings, ComfyWorkflowJSON, etc.
- Added missing type imports where needed
- Replaced as any with proper type intersections for Vue component testing

Files modified:
- ComboWidget.test.ts: Use explicit Values union type
- settingStore.test.ts: Import and use Settings type
- WhatsNewPopup.test.ts: Type assertion with component interface
- useMinimap.test.ts: Remove unnecessary cast (renderMinimap is public)
- LGraphNode.test.ts: Remove unnecessary any cast from undefined
- WidgetGalleria.test.ts: Type intersection for vm access
- WidgetInputNumberInput.test.ts: Use unknown to number cast
- jobOutputCache.test.ts: Import ComfyWorkflowJSON type
- mediaCacheService.test.ts: Use Partial<typeof URL> cast
- registrySearchProvider.test.ts: Use ReturnType<typeof store>
- firebaseAuthStore.test.ts: Cast to UserCredential
- queueStore.test.ts: Use Record<string, unknown> for delete
- usePacksSelection.test.ts: Cast undefined to unknown to string
- usePacksStatus.test.ts: Cast undefined to unknown to string
- useConflictDetection.test.ts: Use inline type for ImportFailInfo

Reduced as any count from 326 to 311 instances.
2026-01-22 19:32:16 +01:00
Johnpaul
181f8c3a88 refactor: remove any types from modelStore, surveyNormalization, and SurveyResponses
- modelStore.ts: Changed _findInMetadata metadata parameter from any to Record<string, unknown> with type guards
- surveyNormalization.ts: Changed normalizeSurveyResponses to use generic Record<string, unknown> constraint with proper type guards
- types.ts: Added index signature to SurveyResponses to allow normalized properties
2026-01-22 19:13:42 +01:00
Johnpaul
5683c388e4 refactor: remove any types from fuseUtil, ui, isobmff, and fix clipspace
- fuseUtil.ts: Changed isFuseSearchable type guard from any to unknown with proper null checks
- ui.ts: Changed Props index signature from any to unknown
- isobmff.ts: Changed extractJson return type from any to unknown with type assertion at call site
- clipspace.ts: Fixed pre-existing typecheck error by changing createImgSettings and createImgPreview to return null instead of empty array
2026-01-22 19:07:26 +01:00
Johnpaul
35139da175 refactor: remove any types from widget and template files
- widgetInputs: use TWidgetValue[] for controlValues instead of any[]
- nodeTemplates: define NodeTemplate interface with name and data properties
2026-01-22 17:59:37 +01:00
Johnpaul
2282f37fb5 refactor: remove any types from utility files and components
- syncUtil: use UserDataFullInfo type from apiSchema for file parameters
- linkFixer: change logger parameters from any[] to unknown[]
- useChainCallback: use NonNullable and conditional types instead of any constraint
- FormRadioGroup: type modelValue as string | number | undefined
- async.ts: define GlobalWindow as typeof globalThis
- widgetInputs: use Parameters<NonNullable<T>> for callback parameters
- useWorkflowValidation: update logger to accept unknown[] parameters
2026-01-22 04:24:45 +01:00
Johnpaul
a02f7a15ff refactor: replace custom callback types with TypeScript built-in utilities
- Use Parameters<NonNullable<T>> and ReturnType<NonNullable<T>> instead of custom CallbackParams/CallbackReturn types
- Change any[] to unknown[] in extensionService invokeExtensions methods
- Update contextMenuFilter.test.ts with type assertions for extension results
2026-01-22 03:56:29 +01:00
Johnpaul
2aa4885696 refactor: remove any types from test files (batch 5)
Remove explicit any types from 14 test files:
- useMissingNodes.test.ts (1 instance)
- DescriptionTabPanel.test.ts (1 instance)
- PackEnableToggle.test.ts (3 instances)
- NodeConflictDialogContent.test.ts (7 instances)
- queueStore.test.ts (2 instances)
- useIntWidget.test.ts (1 instance)
- useFloatWidget.test.ts (1 instance)
- FormSelectButton.test.ts (3 instances)
- useTemplateWorkflows.test.ts (1 instance)
- useFrontendVersionMismatchWarning.test.ts (1 instance)
- releaseService.test.ts (1 instance)
- useSubscription.test.ts (1 instance)
- assetService.test.ts (1 instance)
- ResultGallery.test.ts (2 instances)

Used typed mock objects, ReturnType pattern, and specific type aliases
where appropriate. All changes pass typecheck with 0 errors.
2026-01-22 03:30:18 +01:00
Johnpaul
dbf6d02f0d refactor: remove any types from subgraphNavigationStore.test.ts
Remove explicit any types from 1 test file:
- subgraphNavigationStore.test.ts (11 instances)

Used typeof workflowStore.activeWorkflow to properly type workflow
mock assignments instead of the broader ComfyWorkflow type.
2026-01-22 00:20:55 +01:00
Johnpaul
06dbb0fd32 refactor: remove any types from test files (batch 3)
Remove explicit any types from 2 test files:
- firebaseAuthStore.test.ts (10 instances)
- useMinimapSettings.test.ts (10 instances)

Changes:
- Created MockAuth type for firebase auth mocks
- Used UserCredential type for firebase user credential mocks
- Used `ReturnType<typeof func>` to derive proper store types
- Changed Record<string, any> to Record<string, unknown>

All changes pass typecheck and tests.
2026-01-22 00:16:15 +01:00
Johnpaul
94fc1f6e30 refactor: remove any types from test files (batch 2)
Remove explicit any types from 3 test files:
- SubgraphMemory.test.ts (10 instances)
- minimapCanvasRenderer.test.ts (8 instances)
- useImageLoader.test.ts (8 instances)

Changes:
- Created InputWithWidget type for test-specific widget properties
- Used `unknown` type with proper type annotations for mock store properties
- Used `as unknown as T` pattern for mock objects
- Used `ReturnType<typeof func>` for store mock return types

All changes pass typecheck and tests.
2026-01-22 00:08:42 +01:00
Johnpaul
27359f945b refactor: remove any types from test files (batch 1)
Remove explicit any types from 7 test files:
- useWatchWidget.test.ts (3 instances)
- LGraphNodeProperties.test.ts (2 instances)
- versionCompatibilityStore.test.ts (2 instances)
- workflowStore.test.ts (2 instances)
- useRemoteWidget.test.ts (2 instances)
- registrySearchGateway.test.ts (2 instances)
- colorUtil.test.ts (2 instances)

Changes:
- Used `unknown` for truly unknown values instead of `any`
- Used `Partial<T>` with type assertions for mock objects
- Used `ReturnType<typeof func>` to derive proper types
- Used proper typing for promise resolvers and spy mocks
- Used `this: unknown` with proper casting for function contexts

All changes pass typecheck and tests.
2026-01-22 00:02:14 +01:00
Johnpaul
dc9f75c011 refactor: remove any types from useMinimap and firebaseAuthStore tests
- useMinimap.test.ts: Created comprehensive mock interfaces for Node, Graph, Canvas, CanvasElement, ContainerElement, and Context2D
- firebaseAuthStore.test.ts: Imported User type from firebase/auth and created MockUser type for mocking

Part 8 - Phase 5 complete: 2 files fixed, 14 any instances removed (9 + 5)
2026-01-21 23:46:43 +01:00
Johnpaul
20a0ae04cf refactor: remove any types from releaseStore, ExecuteButton, and useManagerQueue tests
- releaseStore.test.ts: Created mock interfaces for ReleaseService, SettingStore, and SystemStatsStore with proper typing
- ExecuteButton.test.ts: Added Mock type interfaces for Canvas, CanvasStore, and CommandStore
- useManagerQueue.test.ts: Fixed Ref types and used correct ManagerPackInstalled schema types

Part 8 - Phase 4 complete: 8 files fixed, 32 any instances removed
2026-01-21 22:40:55 +01:00
Johnpaul
415845a325 refactor: fix normalizeIndustry and normalizeUseCase to accept unknown
- Change parameter types from string to unknown in both functions
- Functions already have type guards (typeof check) to handle invalid inputs
- Remove all 'as any' casts from tests - no longer needed
- Better type safety: functions now properly express they can handle any input
2026-01-21 22:11:11 +01:00
Johnpaul
4014984300 refactor: remove any types from useSettingSearch.test.ts
- Import SettingParams, SettingTreeNode types from settingStore
- Replace mockSettingStore: any with ReturnType<typeof useSettingStore>
- Replace mockSettings: any with properly typed Record<string, SettingParams> with double-cast
- Replace setting: any parameter with SettingParams in getSettingInfo mock
- Replace activeCategory as any with Partial<SettingTreeNode> and proper cast
- Add casts for dynamically assigned mock settings
2026-01-21 21:59:26 +01:00
Johnpaul
d4af46327b refactor: remove any types from algoliaSearchProvider.test.ts
- Define RegistryNodePack type from comfyRegistryTypes
- Create GlobalWithAlgolia interface for global properties
- Replace (global as any) with properly typed (globalThis as unknown as GlobalWithAlgolia)
- Type testPack and incompletePack as Partial<RegistryNodePack>
- Replace as any casts with as RegistryNodePack
2026-01-21 21:55:29 +01:00
Johnpaul
acccd6c3a7 refactor: remove any types from contextMenuCompat.test.ts
- Replace ...args: any[] with proper return type annotations
- Replace (original as any).apply() with original.call()
- Replace (originalGetCanvasMenuOptions as any).apply() with .call()
- Add explicit return type (IContextMenuValue | null)[] to functions
2026-01-21 21:48:30 +01:00
Johnpaul
489af6df76 refactor: remove any types from contextMenuFilter.name.test.ts
- Import IContextMenuValue and LGraphNode types
- Replace ...args: any[] with proper parameter types (none for getCanvasMenuOptions, node: LGraphNode for getNodeMenuOptions)
- Replace (original as any).apply() with original.call() with proper typing
- Add explicit return type annotation for monkey-patched methods
2026-01-21 21:41:03 +01:00
Johnpaul
692528cd12 refactor: remove any types from systemStatsStore.test.ts
- Import SystemStats type from apiSchema
- Replace null as any with proper SystemStats type
- Replace Promise<any> with Promise<SystemStats>
- Replace partial system object cast with SystemStats['system']
- Add necessary cast for empty object in test
2026-01-21 21:24:37 +01:00
Johnpaul
9c3a94ba1a refactor: remove any types from keybindingService.forwarding.test.ts
- Replace dialogStack mock 'as any' with ReturnType<typeof useDialogStore>
- Replace undefined/null assignments with double-cast using typeof saved variables
- All 3 instances now properly typed
2026-01-21 21:20:05 +01:00
Johnpaul
ea52855142 refactor: remove any types from api.featureFlags.test.ts
- Define MockWebSocket interface with proper Mock types
- Replace mockWebSocket: any with MockWebSocket type
- Replace event: any with unknown in event handlers
- Import Mock type from vitest
2026-01-21 21:12:55 +01:00
Johnpaul
c1137c6c8f refactor: remove any types from useTemplateUrlLoader.test.ts
- Update mockQueryParams type to include string[] for Vue Router query params
- Replace params?: any with unknown and inline type assertion
- Remove unnecessary 'as any' casts from array assignments
2026-01-21 21:11:02 +01:00
Johnpaul
a6af53ff29 refactor: remove any types from SubgraphNode.titleButton.test.ts
- Define MockPointerEvent interface for canvas events
- Import CanvasPointerEvent type from events module
- Replace 3 'as any' casts with proper typed interface and double-cast
2026-01-21 21:08:59 +01:00
Johnpaul
7d16f0c9f6 refactor: remove any types from LinkConnectorSubgraphInputValidation.test.ts
- Define MockPointerEvent interface for canvas pointer events
- Define MockRenderLink interface for partial render link mocks
- Import CanvasPointerEvent type from events module
- Replace 3 'as any' casts with proper typed interfaces and double-cast
2026-01-21 21:07:00 +01:00
Johnpaul
72ed73dead refactor: remove any types from LGraphNode.test.ts
- Define NodeConstructorWithSlotOffset interface for constructor with optional slot_start_y
- Replace 3 'as any' casts with proper double-cast pattern
- All instances related to dynamic slot_start_y property on node constructor
2026-01-21 21:03:29 +01:00
Johnpaul
6219bb54af test: remove any from useNodePricing.test.ts (3 instances)
- Define MockNodeInput interface for test inputs
- Replace widgets value: any with unknown
- Replace const node: any with proper object and double-cast to LGraphNode
- Add explicit return type boolean to isInputConnected
2026-01-21 20:53:00 +01:00
GitHub Action
2381cb9810 [automated] Apply ESLint and Oxfmt fixes 2026-01-21 19:01:16 +00:00
Johnpaul
ce3985fb11 test: remove any from ColorPickerButton.test.ts (3 instances)
- Replace activeWorkflow mock with LoadedComfyWorkflow type and double-cast
- Replace selectedItems mocks with Positionable type and double-cast
- Import Mock type from vitest for checkState mock
2026-01-21 19:58:49 +01:00
Johnpaul
8574af95ea test: remove any from litegraphUtil.test.ts
- Replace widgetValues: any[] with unknown[]
2026-01-21 19:14:55 +01:00
Johnpaul
092e08df26 test: remove any from newUserService.test.ts
- Define MockSettingStore interface with proper Mock types
- Create mockSettingStoreTyped with double-cast to useSettingStore return type
- Replace all mockSettingStore usages in initializeIfNewUser calls
- Import useSettingStore type from correct path
2026-01-21 18:55:07 +01:00
Johnpaul
1e2aac04e1 test: remove any from nodeOrganizationService.test.ts
- Replace overrides: any with Record<string, unknown> in createMockNodeDef
- Replace 'unknown' as any with double-cast to NodeSourceType
2026-01-21 18:49:10 +01:00
Johnpaul
f4934bf127 test: remove mockSearchClient any from algoliaSearchProvider.test.ts
- Define MockSearchClient interface with search: Mock property
- Replace mockSearchClient: any with MockSearchClient type
- Apply double-cast when setting up mock return value
- Note: File still has other any instances for global properties and test casts
2026-01-21 18:47:50 +01:00
Johnpaul
08fc8131f6 test: remove any from textUtils.test.ts
- Replace (ctx.measureText as any) with (ctx.measureText as Mock)
- Import Mock type from vitest
2026-01-21 14:00:56 +01:00
Johnpaul
e340f028f0 test: remove any from SubgraphWidgetPromotion.test.ts
- Replace widgetValue: any with unknown in createNodeWithWidget helper
2026-01-21 12:48:07 +01:00
Johnpaul
b7f2359097 test: remove any from SubgraphSlotVisualFeedback.test.ts
- Replace mockColorContext: any with proper MockColorContext interface
- Apply double-cast at draw() call sites to satisfy DefaultConnectionColors type
- Pattern: colorContext: mockColorContext as unknown as DefaultConnectionColors
2026-01-21 03:04:43 +01:00
Johnpaul
ad52e29562 test: Remove unnecessary assertion from shared.test.ts. 2026-01-21 02:55:19 +01:00
Johnpaul
f570b397a5 test: remove any type from BaseThumbnail test component instance
- Replace `wrapper.vm as any` with properly typed ComponentInstance
- Define ComponentInstance type with error property
- Improve type safety for internal state access in tests

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:50:24 +01:00
Johnpaul
ca4fe3fd69 test: remove any type from UsageLogsTable test ComponentInstance
- Replace `events: any[]` with properly typed `MockEvent[]`
- Define MockEvent interface matching the test data structure
- Improve type safety for event testing

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:45:44 +01:00
Johnpaul
ab1a19bcee test: remove any type from ApiKeyForm test mountComponent helper
- Replace `props: any` with ComponentProps<typeof ApiKeyForm>
- Import ComponentProps from vue-component-type-helpers
- Linter optimized to direct ComponentProps usage

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:43:54 +01:00
Johnpaul
88fb21194f test: remove any type from SettingItem test mountComponent helper
- Replace `props: any` and return type with proper types
- Use Record<string, unknown> with ComponentProps cast
- Refactor tests to check FormItem component props instead of internal state
- Import ComponentProps from vue-component-type-helpers

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:41:31 +01:00
Johnpaul
892b29b694 Merge remote-tracking branch 'origin/main' into fix/remove-any-types-part8 2026-01-21 02:25:22 +01:00
Johnpaul
4200c36a26 test: remove any type from UserAvatar test mountComponent helper
- Replace `props: any` with `Record<string, unknown>`
- Use ComponentProps type assertion for type safety
- Import ComponentProps from vue-component-type-helpers

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:24:44 +01:00
Johnpaul
f31ca7932a test: remove any type from BaseTerminal test mock access
- Replace `as any` with proper `Mock` type from vitest
- Import Mock type and access mock.calls with type safety
- Explicitly type selectionCallback as `() => void`
- Break down mock access into steps for clarity

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:21:13 +01:00
Johnpaul
96aa53e5a6 test: remove any type from UrlInput test mountComponent helper
- Replace `props: any` with `Record<string, unknown>`
- Use ComponentProps type assertion for type safety
- Refactor tests to check input.element.value instead of internal state
- This tests actual DOM behavior rather than implementation details

Part of Phase 2 - Quick wins (1 instance removed)
2026-01-21 02:02:27 +01:00
Johnpaul
755ad206df test: remove explicit any type from FormRadioGroup.test.ts
Replaced any with Record<string, unknown> for mountComponent props parameter.
Uses as unknown as cast to allow testing edge cases with invalid prop types.

All tests passing (11/11), 0 typecheck errors.

Part of #8092
2026-01-21 01:55:29 +01:00
Johnpaul
c72e6ce520 test: remove explicit any types from useSelectionState.test.ts
Removed all 14 any types from Pinia store mocks.

Changes:
- Replaced as any with as unknown as ReturnType<typeof store> pattern
- Removed as any from $state and _p properties (empty objects)

All tests passing (6/6), 0 typecheck errors.

Part of #8092
2026-01-21 01:50:48 +01:00
Alexander Brown
b1dfbfaa09 chore: Replace prettier with oxfmt (#8177)
Configure oxfmt ignorePatterns to exclude non-JS/TS files (md, json,
css, yaml, etc.) to match previous Prettier behavior.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8177-chore-configure-oxfmt-to-format-only-JS-TS-Vue-files-2ee6d73d3650815080f3cc8a4a932109)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-01-20 16:44:08 -08:00
Johnpaul
3a0ee293ea test: remove explicit any type from useSelectedLiteGraphItems.test.ts
Replaced any with proper type for mockCanvas.

Changes:
- Typed mockCanvas as { selectedItems: Set<Positionable> }
- Added as unknown as Positionable casts for MockNode instances
- Added as unknown as cast for getCanvas mock return value

All tests passing (18/18), 0 typecheck errors.

Part of #8092
2026-01-21 01:40:39 +01:00
Johnpaul
2bd5dea728 test: remove explicit any types from useGraphHierarchy.test.ts
Removed all 3 any types and replaced with proper TypeScript types.

Changes:
- Replaced as any with as unknown as for partial mockCanvasStore
- Removed as any from null assignments (TypeScript infers correctly)

All tests passing (7/7), 0 typecheck errors.

Part of #8092
2026-01-21 01:21:05 +01:00
Johnpaul
0fb836b294 test: remove explicit any types from useFeatureFlags.test.ts
Removed all 7 any types by removing unnecessary type assertions.

TypeScript can infer return types correctly for mockImplementation
callbacks returning literal values.

All tests passing (8/8), 0 typecheck errors.

Part of #8092
2026-01-21 01:18:04 +01:00