Back to all reviewers

organize for readability

unionlabs/union
Based on 2 comments
TypeScript

Structure code to minimize repetition and improve clarity through appropriate abstraction and import organization. When code contains repetitive patterns, create wrapper functions to eliminate boilerplate. For modules with structured exports (like ADTs), prefer qualified imports over individual named imports to maintain clear namespace organization.

Code Style TypeScript

Reviewer Prompt

Structure code to minimize repetition and improve clarity through appropriate abstraction and import organization. When code contains repetitive patterns, create wrapper functions to eliminate boilerplate. For modules with structured exports (like ADTs), prefer qualified imports over individual named imports to maintain clear namespace organization.

Example of abstracting repetitive patterns:

// Instead of repeating tryPromise wrapping:
const amount = yield* Effect.tryPromise({
  try: () => client.getBalance(minter, "uxion"),
  catch: e => new Error(`Failed to fetch balance: ${String(e)}`)
})

// Create wrapper functions:
const getBalance = (address: string, denom: string) => 
  Effect.tryPromise({
    try: () => client.getBalance(address, denom),
    catch: e => new Error(`Failed to fetch balance: ${String(e)}`)
  })

// Then use: yield* getBalance(minter, "uxion")

Example of qualified imports for structured modules:

// Instead of:
import { Batch, Forward, FungibleAssetOrder, Multiplex } from "../src/ucs03/instruction.js"

// Use qualified import:
import * as Instruction from "../src/ucs03/instruction.js"

This approach reduces visual clutter, makes the code’s intent clearer, and creates more maintainable examples and implementations.

2
Comments Analyzed
TypeScript
Primary Language
Code Style
Category

Source Discussions