Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knip #2635

Merged
merged 4 commits into from
Jan 11, 2025
Merged

knip #2635

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"ignore": [
"eliza/**",

"**/*.js",
"**/vitest**",
"client/apps/game/src/setupTests.ts",

"client/sdk/packages/eternum/global.d.ts",

"**/**__test__**/**",
"**/**__tests__**/**",

"client/apps/landing/src/routeTree.gen.ts",
"client/apps/landing/src/components/ui/**",
"client/apps/landing/src/components/typography/**",
"client/apps/landing/src/hooks/gql/**",

"client/apps/game-docs/vocs.config.ts",
"client/apps/game-docs/docs/**",
"client/apps/game-docs/vocs.config.ts",

"client/apps/game/src/ui/modules/chat/**"
]
}
42 changes: 0 additions & 42 deletions client/.knip.json

This file was deleted.

6 changes: 3 additions & 3 deletions client/apps/balancing/src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

Expand All @@ -20,10 +20,10 @@ const badgeVariants = cva(
},
);

export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
}

export { Badge, badgeVariants };
export { Badge };
2 changes: 1 addition & 1 deletion client/apps/balancing/src/components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttribu
);
TableCaption.displayName = "TableCaption";

export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
export { Table, TableBody, TableCell, TableHead, TableHeader, TableRow };
13 changes: 0 additions & 13 deletions client/apps/game/.eslintrc.json

This file was deleted.

6 changes: 0 additions & 6 deletions client/apps/game/pwa-assets.config.ts

This file was deleted.

2 changes: 0 additions & 2 deletions client/apps/game/src/dojo/contractComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import { defineComponent, Type as RecsType, type World } from "@dojoengine/recs";

export type ContractComponents = ReturnType<typeof defineContractComponents>;

export function defineContractComponents(world: World) {
return {
AddressName: (() => {
Expand Down
41 changes: 0 additions & 41 deletions client/apps/game/src/dojo/debouncedQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
addMarketSubscription,
addToSubscription,
addToSubscriptionOneKeyModelbyRealmEntityId,
addToSubscriptionTwoKeyModelbyRealmEntityId,
syncPosition,
} from "./queries";

// Queue class to manage requests
Expand Down Expand Up @@ -52,40 +50,9 @@ class RequestQueue {
}
}

// Create separate queues for different types of requests
const positionQueue = new RequestQueue();
const subscriptionQueue = new RequestQueue();
const marketQueue = new RequestQueue();
const hyperstructureQueue = new RequestQueue();
// Debounced functions that add to queues
export const debouncedSyncPosition = debounce(
async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
entityID: string,
onComplete?: () => void,
) => {
await positionQueue.add(() => syncPosition(client, components, entityID), onComplete);
},
100,
{ leading: true }, // Add leading: true to execute immediately on first call
);

export const debouncedAddToSubscriptionTwoKey = debounce(
async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
entityID: string[],
onComplete?: () => void,
) => {
await subscriptionQueue.add(
() => addToSubscriptionTwoKeyModelbyRealmEntityId(client, components, entityID),
onComplete,
);
},
250,
{ leading: true },
);

export const debouncedAddToSubscriptionOneKey = debounce(
async <S extends Schema>(
Expand Down Expand Up @@ -153,11 +120,3 @@ export const debouncedAddHyperstructureSubscription = debounce(
500,
{ leading: true },
);

// Utility function to clear all queues if needed
export const clearAllQueues = () => {
positionQueue.clear();
subscriptionQueue.clear();
marketQueue.clear();
hyperstructureQueue.clear();
};
50 changes: 0 additions & 50 deletions client/apps/game/src/dojo/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,6 @@ import { PatternMatching, ToriiClient } from "@dojoengine/torii-client";
// on hexception -> fetch below queries based on entityID

// background sync after load ->

export const syncPosition = async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
entityID: string,
) => {
await getEntities(
client,
{
Keys: {
keys: [entityID],
pattern_matching: "FixedLen" as PatternMatching,
models: ["s0_eternum-Position"],
},
},
components,
[],
[],
5_000,
);
};

export const addToSubscriptionTwoKeyModelbyRealmEntityId = async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
entityID: string[],
) => {
await getEntities(
client,
{
Composite: {
operator: "Or",
clauses: [
...entityID.map((id) => ({
Keys: {
keys: [id, undefined],
pattern_matching: "VariableLen" as PatternMatching,
models: ["s0_eternum-BuildingQuantityv2"],
},
})),
],
},
},
components,
[],
[],
5_000,
);
};

export const addToSubscriptionOneKeyModelbyRealmEntityId = async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
Expand Down
2 changes: 1 addition & 1 deletion client/apps/game/src/dojo/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type SetupResult = Awaited<ReturnType<typeof setup>>;

export const configManager = ClientConfigManager.instance();

export const syncEntitiesDebounced = async <S extends Schema>(
const syncEntitiesDebounced = async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
entityKeyClause: EntityKeysClause[],
Expand Down
56 changes: 0 additions & 56 deletions client/apps/game/src/dojo/worker.ts

This file was deleted.

Loading
Loading