Skip to content

Commit fe9d945

Browse files
rodrigoolerclaude
andcommitted
refactor: improve code formatting and consistency across packages
Standardize code formatting across UI components, type definitions, utilities, and form components to improve readability and maintain consistency with project styling standards. - Format extends clauses in interface definitions (packages/ui, packages/torus-provider) - Consolidate multi-line extends statements in type definitions (packages/torus-provider) - Improve component imports and export formatting (packages/torus-sdk-ts) - Standardize utility function formatting (packages/torus-utils) - Update test setup and worker scripts for consistency (apps/torus-bridge, services/torus-worker) - Format Discord auth and form components (apps/torus-governance, apps/torus-portal) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 97d6e35 commit fe9d945

File tree

16 files changed

+60
-50
lines changed

16 files changed

+60
-50
lines changed

apps/torus-bridge/src/test/setup.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "@torus-ts/vitest-config/setup";
1+
import "@testing-library/jest-dom";
22
import { configure } from "@testing-library/react";
33
import { createElement } from "react";
44
import { vi } from "vitest";
@@ -143,12 +143,10 @@ vi.mock("wagmi", () => ({
143143
}),
144144
useBalance: () => ({
145145
data: { value: 5n * 10n ** 18n },
146-
refetch: vi
147-
.fn()
148-
.mockResolvedValue({
149-
status: "success",
150-
data: { value: 5n * 10n ** 18n },
151-
}),
146+
refetch: vi.fn().mockResolvedValue({
147+
status: "success",
148+
data: { value: 5n * 10n ** 18n },
149+
}),
152150
}),
153151
useClient: () => ({}),
154152
useConfig: () => ({}),

apps/torus-governance/src/app/_components/discord-auth-button.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import { Icons } from "@torus-ts/ui/components/icons";
77
import * as React from "react";
88
import { useDiscordAuth } from "../../../hooks/use-discord-auth";
99

10-
interface DiscordAuthButtonProps
11-
extends Omit<ButtonProps, "onClick" | "onError"> {
10+
interface DiscordAuthButtonProps extends Omit<
11+
ButtonProps,
12+
"onClick" | "onError"
13+
> {
1214
onSignIn?: () => void | Promise<void>;
1315
onSignOut?: () => void | Promise<void>;
1416
onError?: (error: Error) => void;

apps/torus-portal/src/app/(pages)/capabilities/register-capability/_components/create-capability-form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ export function RegisterCapabilityForm({
215215
title="Capability Creation Fee"
216216
isVisible={Boolean(
217217
isAccountConnected &&
218-
selectedPrefix &&
219-
fullPath.trim().length > 0 &&
220-
!isPending &&
221-
!isSigning,
218+
selectedPrefix &&
219+
fullPath.trim().length > 0 &&
220+
!isPending &&
221+
!isSigning,
222222
)}
223223
isLoading={namespaceFee.isLoading}
224224
error={namespaceFee.error}

apps/torus-portal/src/app/(pages)/network-operations/register-agent/_components/register-agent-form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ export function RegisterAgentForm({
174174
title="Agent Registration Fee"
175175
isVisible={Boolean(
176176
isAccountConnected &&
177-
formValues.name &&
178-
formValues.name.trim().length > 0 &&
179-
!isPending,
177+
formValues.name &&
178+
formValues.name.trim().length > 0 &&
179+
!isPending,
180180
)}
181181
isLoading={agentRegistrationFee.isLoading}
182182
error={agentRegistrationFee.error}

packages/torus-provider/src/_types/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export interface AddDaoTreasuryTransferProposal {
6868
}
6969

7070
export interface AddEmissionProposal
71-
extends Omit<EmissionProposal, "api">,
72-
TransactionHelpers {}
71+
extends Omit<EmissionProposal, "api">, TransactionHelpers {}
7372

7473
export interface AddAgentApplication extends TransactionHelpers {
7574
IpfsHash: string;

packages/torus-provider/src/torus-provider.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ export function TorusProvider({
7575
useState<InjectedAccountWithMeta | null>(null);
7676

7777
async function loadTorusApi(): Promise<void> {
78-
const { web3Accounts, web3Enable, web3FromAddress } = await import(
79-
"@polkadot/extension-dapp"
80-
);
78+
const { web3Accounts, web3Enable, web3FromAddress } =
79+
await import("@polkadot/extension-dapp");
8180

8281
setTorusApi({
8382
web3Enable,

packages/torus-sdk-ts/src/extrinsics.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,10 @@ export interface ExtrinsicTrackerEvents {
723723
* });
724724
* ```
725725
*/
726-
export interface ExtrinsicTracker
727-
extends Pick<
728-
Emittery<ExtrinsicTrackerEvents>,
729-
"on" | "off" | "once" | "events"
730-
> {
726+
export interface ExtrinsicTracker extends Pick<
727+
Emittery<ExtrinsicTrackerEvents>,
728+
"on" | "off" | "once" | "events"
729+
> {
731730
/** Raw event emitter for advanced use cases */
732731
emitter: Emittery<ExtrinsicTrackerEvents>;
733732

packages/torus-utils/src/bignumber.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ export const buildTaggedBigNumberClass = <Tag extends string>(
136136
*
137137
* @template Tag - A string literal type used to tag the BigNumber instance.
138138
*/
139-
export class BigNumberBrand<Tag extends string>
140-
implements TransformBigNumberMethods<BigNumber, BigNumberBrand<Tag>>
141-
{
139+
export class BigNumberBrand<
140+
Tag extends string,
141+
> implements TransformBigNumberMethods<BigNumber, BigNumberBrand<Tag>> {
142142
static readonly _tag: string;
143143

144144
// Using a phantom property ensures nominal typing at the TypeScript level

packages/ui/src/components/badge.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const badgeVariants = cva(
2424
);
2525

2626
export interface BadgeProps
27-
extends React.HTMLAttributes<HTMLDivElement>,
27+
extends
28+
React.HTMLAttributes<HTMLDivElement>,
2829
VariantProps<typeof badgeVariants> {}
2930

3031
function Badge({ className, variant, ...props }: BadgeProps) {

packages/ui/src/components/button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const buttonVariants = cva(
3535
);
3636

3737
export interface ButtonProps
38-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38+
extends
39+
React.ButtonHTMLAttributes<HTMLButtonElement>,
3940
VariantProps<typeof buttonVariants> {
4041
asChild?: boolean;
4142
}

0 commit comments

Comments
 (0)