chore: clean up code formatting and remove unused files - #45
Conversation
- Updated Jest configuration for consistent formatting. - Removed deprecated ROADMAP.md file. - Cleaned up various files by removing trailing commas and ensuring consistent formatting. - Updated README to direct users to CONTRIBUTING.md for development guidelines. - Removed unused GitHub Actions workflow for testing.
WalkthroughThis update introduces widespread code style changes, primarily removing trailing commas from object and array literals across the codebase, including source files, schemas, decoders, processors, and test fixtures. Additionally, it adds a Prettier configuration, expands CI checks to include linting and formatting, enhances Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant Linter
participant TypeChecker
participant Prettier
participant Test Runner
Developer->>GitHub Actions: Push or PR triggers CI
GitHub Actions->>Linter: Run ESLint (pnpm lint)
GitHub Actions->>TypeChecker: Run TypeScript typecheck (pnpm typecheck)
GitHub Actions->>Prettier: Check formatting (pnpm prettier --check)
GitHub Actions->>Test Runner: Run tests (pnpm test)
Test Runner-->>GitHub Actions: Report results
GitHub Actions-->>Developer: CI status feedback
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
src/metadata-resolver.ts (1)
27-34: Handle rejected promises fromPromise.allSettledOnly the
"fulfilled"branch is inspected. If any metadata request is rejected, the failure is silently ignored – the caller receives no hint that something went wrong. This can mask upstream API issues and make troubleshooting difficult.const metadata = nftMetadata.reduce<Metadata>((acc, promise, index) => { - if (promise.status === "fulfilled") { + if (promise.status === "fulfilled") { … return acc; + } else if (promise.status === "rejected") { + console.error( + `Failed to resolve metadata for object address ${tokenAddresses[index]}:`, + promise.reason + ); + return acc; } return acc; }, {});Adding the
rejectedbranch keeps behaviour unchanged (no entry added) while at least surfacing the error for observability.
🧹 Nitpick comments (5)
src/decoder.ts (1)
13-14: Merge duplicate imports from the same module
attachTxLogs,mergeBalanceChanges, andcreateNotSupportedMessageare imported from"./utils"in two separate statements. Consolidating them into a single import improves readability and avoids redundant module resolution.-import { attachTxLogs, mergeBalanceChanges } from "./utils"; -import { createNotSupportedMessage } from "./utils"; +import { + attachTxLogs, + mergeBalanceChanges, + createNotSupportedMessage +} from "./utils";.prettierrc (1)
1-4: Prettier config introduced – consider pinning additional rules
printWidthandtrailingCommaare set, but common defaults like"singleQuote": trueor"arrowParens": "always"are not specified. Adding them now avoids future churn if the team decides on those conventions.src/decoders/ibc/nft.ts (2)
100-108: Prefer??over||for nullable URI fallbackUsing the nullish-coalescing operator avoids treating an empty string as “missing”:
- uri: collection.data.uri || parsedData.data.classUri + uri: collection.data.uri ?? parsedData.data.classUriSame applies below in the receive decoder.
226-232: Apply the same nullish-coalescing fix here- uri: collection.data.uri || parsedData.data.classUri + uri: collection.data.uri ?? parsedData.data.classUripackage.json (1)
32-40: Consider making CI lint fail on unfixable issuesRunning
eslint --fixin thelintscript silently modifies code. For deterministic CI you might separate the commands:- "lint": "eslint \"{src,tests}/**/*.ts\" --fix", + "lint": "eslint \"{src,tests}/**/*.ts\" --max-warnings 0", + "lint:fix": "eslint \"{src,tests}/**/*.ts\" --fix",This allows
pnpm lintto fail when issues remain while still exposing an explicit auto-fix target.
Summary by CodeRabbit
New Features
Chores
Documentation
Style
Tests