Skip to content

Commit 3fbcf4a

Browse files
authored
knip: YOLO pass, all the unused exports enabled, YAGNI for the rest (#5313)
* knip: Enable unusedBinaries, add two exceptions * knip: YOLO pass, all the unused exports enabled. Paired with @christian-byrne to allow for some special cases to remain with custom knip ignore tags. * knip: remove post-rebase
1 parent 006e6bd commit 3fbcf4a

35 files changed

+22
-883
lines changed

knip.config.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const config: KnipConfig = {
1616
'tests-ui/**/*.{js,ts,vue}',
1717
'*.{js,ts,mts}'
1818
],
19+
ignoreBinaries: ['only-allow', 'openapi-typescript'],
1920
ignoreDependencies: [
2021
'@primeuix/forms',
2122
'@primeuix/styled',
@@ -59,7 +60,11 @@ const config: KnipConfig = {
5960
'src/components/button/TextButton.vue',
6061
'src/components/card/CardTitle.vue',
6162
'src/components/card/CardDescription.vue',
62-
'src/components/input/SingleSelect.vue'
63+
'src/components/input/SingleSelect.vue',
64+
// Used by a custom node (that should move off of this)
65+
'src/scripts/ui/components/splitButton.ts',
66+
// Generated file: openapi
67+
'src/types/comfyRegistryTypes.ts'
6368
],
6469
ignoreExportsUsedInFile: true,
6570
// Vue-specific configuration
@@ -68,15 +73,12 @@ const config: KnipConfig = {
6873
// Only check for unused files, disable all other rules
6974
// TODO: Gradually enable other rules - see https://github.com/Comfy-Org/ComfyUI_frontend/issues/4888
7075
rules: {
71-
binaries: 'off',
72-
classMembers: 'off',
73-
duplicates: 'off',
74-
enumMembers: 'off',
75-
exports: 'off',
76-
nsExports: 'off',
77-
nsTypes: 'off',
78-
types: 'off'
76+
classMembers: 'off'
7977
},
78+
tags: [
79+
'-knipIgnoreUnusedButUsedByCustomNodes',
80+
'-knipIgnoreUnusedButUsedByVueNodesBranch'
81+
],
8082
// Include dependencies analysis
8183
includeEntryExports: true
8284
}

src/composables/useTemplateFiltering.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { type Ref, computed, ref } from 'vue'
22

33
import type { TemplateInfo } from '@/types/workflowTemplateTypes'
44

5-
export interface TemplateFilterOptions {
5+
// @ts-expect-error unused (To be used later?)
6+
interface TemplateFilterOptions {
67
searchQuery?: string
78
}
89

src/constants/serverConfig.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
AutoLaunch,
32
CrossAttentionMethod,
43
CudaMalloc,
54
FloatingPointPrecision,
@@ -20,32 +19,6 @@ export interface ServerConfig<T> extends FormItem {
2019
getValue?: (value: T) => Record<string, ServerConfigValue>
2120
}
2221

23-
export const WEB_ONLY_CONFIG_ITEMS: ServerConfig<any>[] = [
24-
// Launch behavior
25-
{
26-
id: 'auto-launch',
27-
name: 'Automatically opens in the browser on startup',
28-
category: ['Launch'],
29-
type: 'combo',
30-
options: Object.values(AutoLaunch),
31-
defaultValue: AutoLaunch.Auto,
32-
getValue: (value: AutoLaunch) => {
33-
switch (value) {
34-
case AutoLaunch.Auto:
35-
return {}
36-
case AutoLaunch.Enable:
37-
return {
38-
['auto-launch']: true
39-
}
40-
case AutoLaunch.Disable:
41-
return {
42-
['disable-auto-launch']: true
43-
}
44-
}
45-
}
46-
}
47-
]
48-
4922
export const SERVER_CONFIG_ITEMS: ServerConfig<any>[] = [
5023
// Network settings
5124
{

src/extensions/core/load3d/interfaces.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,3 @@ export interface LoaderManagerInterface {
185185
dispose(): void
186186
loadModel(url: string, originalFileName?: string): Promise<void>
187187
}
188-
189-
export interface RecordingManagerInterface extends BaseManager {
190-
startRecording(): Promise<void>
191-
stopRecording(): void
192-
hasRecording(): boolean
193-
getRecordingDuration(): number
194-
exportRecording(filename?: string): void
195-
clearRecording(): void
196-
}

src/extensions/core/widgetInputs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ function getConfig(this: LGraphNode, widgetName: string) {
422422
* @param node The node to convert the widget to an input slot for.
423423
* @param widget The widget to convert to an input slot.
424424
* @returns The input slot that was converted from the widget or undefined if the widget is not found.
425+
* @knipIgnoreUnusedButUsedByCustomNodes
425426
*/
426427
export function convertToInput(
427428
node: LGraphNode,

src/lib/litegraph/src/draw.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Rectangle } from './infrastructure/Rectangle'
22
import type { CanvasColour, Rect } from './interfaces'
33
import { LiteGraph } from './litegraph'
4-
import { LinkDirection, RenderShape, TitleMode } from './types/globalEnums'
4+
import { RenderShape, TitleMode } from './types/globalEnums'
55

66
const ELLIPSIS = '\u2026'
77
const TWO_DOT_LEADER = '\u2025'
@@ -22,12 +22,7 @@ export enum SlotShape {
2222
}
2323

2424
/** @see LinkDirection */
25-
export enum SlotDirection {
26-
Up = LinkDirection.UP,
27-
Right = LinkDirection.RIGHT,
28-
Down = LinkDirection.DOWN,
29-
Left = LinkDirection.LEFT
30-
}
25+
export enum SlotDirection {}
3126

3227
export enum LabelPosition {
3328
Left = 'left',

src/lib/litegraph/src/interfaces.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ export type KeysOfType<T, Match> = Exclude<
278278
undefined
279279
>
280280

281-
/** A new type that contains only the properties of T that are of type Match */
282-
export type PickByType<T, Match> = { [P in keyof T]: Extract<T[P], Match> }
283-
284281
/** The names of all (optional) methods and functions in T */
285282
export type MethodNames<T> = KeysOfType<T, ((...args: any) => any) | undefined>
286283

src/lib/litegraph/src/litegraph.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ContextMenu } from './ContextMenu'
22
import type { LGraphNode } from './LGraphNode'
33
import { LiteGraphGlobal } from './LiteGraphGlobal'
44
import type { ConnectingLink, Point } from './interfaces'
5-
import type { IContextMenuOptions, INodeSlot, Size } from './interfaces'
5+
import type { IContextMenuOptions, Size } from './interfaces'
66
import { loadPolyfills } from './polyfills'
77
import type { CanvasEventDetail } from './types/events'
88
import type { RenderShape, TitleMode } from './types/globalEnums'
@@ -22,8 +22,6 @@ loadPolyfills()
2222
// Definitions by: NateScarlet <https://github.com/NateScarlet>
2323
/** @deprecated Use {@link Point} instead. */
2424
export type Vector2 = Point
25-
/** @deprecated Use {@link Rect} instead. */
26-
export type Vector4 = [number, number, number, number]
2725

2826
export interface IContextMenuItem {
2927
content: string
@@ -46,14 +44,6 @@ export type ContextMenuEventListener = (
4644
node: LGraphNode
4745
) => boolean | void
4846

49-
export interface LinkReleaseContext {
50-
node_to?: LGraphNode
51-
node_from?: LGraphNode
52-
slot_from: INodeSlot
53-
type_filter_in?: string
54-
type_filter_out?: string
55-
}
56-
5747
export interface LinkReleaseContextExtended {
5848
links: ConnectingLink[]
5949
}
@@ -117,7 +107,6 @@ export type {
117107
LinkNetwork,
118108
LinkSegment,
119109
MethodNames,
120-
PickByType,
121110
Point,
122111
Positionable,
123112
ReadonlyLinkNetwork,

src/lib/litegraph/src/node/slotUtils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ export function isINodeInputSlot(slot: INodeSlot): slot is INodeInputSlot {
8484
return 'link' in slot
8585
}
8686

87-
export function isINodeOutputSlot(slot: INodeSlot): slot is INodeOutputSlot {
88-
return 'links' in slot
89-
}
90-
9187
/**
9288
* Type guard: Whether this input slot is attached to a widget.
9389
* @param slot The slot to check.

src/lib/litegraph/src/types/events.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ export interface CanvasMouseEvent
5050
Readonly<CanvasPointerExtensions>,
5151
LegacyMouseEvent {}
5252

53-
/** DragEvent with canvasX/Y and deltaX/Y properties */
54-
export interface CanvasDragEvent extends DragEvent, CanvasPointerExtensions {}
55-
5653
export type CanvasEventDetail =
5754
| GenericEventDetail
5855
| GroupDoubleClickEventDetail

0 commit comments

Comments
 (0)