Cursor rule
.cursor/rules/typescript.mdcTypeScript/JavaScript File Rules
Cursor rules
Quality
100/100
Scores the file, not the repository.Length
730 words
22 headings · 7 code blocksRepository
126
— · pushed 102 days agoLast changed
3 days ago
First indexed 3 days ago.12345678# TypeScript/JavaScript File Rules910## Overview1112Rules for modifying TypeScript (`*.ts`, `*.tsx`) and JavaScript (`*.js`, `*.jsx`) files in go-crypto-wallet.1314## Applicable Directories1516| App | Language | Runtime | Path | Status |17| ---------------- | --------------------- | ------- | ------------------------ | -------------------------- |18| xrpl-grpc-server | TypeScript | **Bun** | `apps/xrpl-grpc-server/` | **READ-ONLY** (deprecated) |19| eth-contracts | JavaScript/TypeScript | Node.js | `apps/eth-contracts/` | Active |2021## Verification Commands2223**Navigate to app directory first:**2425### xrpl-grpc-server (TypeScript + Bun) - Active Development2627```bash28cd apps/xrpl-grpc-server29bun install # Install dependencies (if needed)30bun run lint # Lint with Biome31bun run format # Format with Biome32bun run typecheck # TypeScript type checking33bun run dev # Run dev server with hot reload34bun run build # Build for production35bun run proto # Generate protobuf code36```3738> **Important**: See @.claude/rules/apps/bun.md for Bun runtime rules.39> **DO NOT** use `npm`/`npx` commands - always use `bun`/`bunx` instead.4041### eth-contracts (JavaScript/Solidity)4243```bash44cd apps/eth-contracts45npm install # Install dependencies (if needed)46npm run lint # Lint Solidity files47npm run lint-js # Lint JavaScript/TypeScript files48npm run fmt # Format all files with Prettier49npm run build # Compile contracts with Truffle50npm run test-all # Run all tests51```5253## Command Summary5455| App | Lint | Format | Build | Test |56| ---------------- | ----------------- | ---------------- | --------------- | ------------------- |57| xrpl-grpc-server | `bun run lint` | `bun run format` | `bun run build` | `bun run typecheck` |58| eth-contracts | `npm run lint-js` | `npm run fmt` | `npm run build` | `npm run test-all` |5960## Code Style6162### TypeScript Best Practices6364```typescript65// Good: Explicit types66function getBalance(address: string): Promise<number> {67 // ...68}6970// Good: Async/await with error handling71async function fetchData(): Promise<Data> {72 try {73 const result = await api.call();74 return result;75 } catch (error) {76 throw new Error(`Failed to fetch data: ${error.message}`);77 }78}7980// Avoid: any type (unless absolutely necessary)81// Bad: function process(data: any)82// Good: function process(data: TransactionData)83```8485### Critical Value Handling8687Never use nullish coalescing (`??`) with empty string for critical values like secrets or keys.88Instead, throw an error to fail fast and prevent silent failures.8990```typescript91// Bad: Silently returns empty string if seed is undefined92const secret = wallet.seed ?? "";9394// Good: Fail fast with explicit error95if (!wallet.seed) {96 throw new Error("Failed to generate a wallet seed.");97}98const secret = wallet.seed;99```100101### Module Exports102103Prefer named exports over default exports for consistency and better tooling support.104105```typescript106// Bad: Mixed exports cause inconsistent import styles107export const myService = { ... };108export default myService;109110// Good: Named exports only111export const myService = { ... };112```113114### Import Order1151161. Node.js built-ins1172. External packages1183. Internal modules119120#### xrpl-grpc-server (xrpl.js 4.5.0)121122```typescript123import * as path from "path";124125import { Client, Wallet, xrpToDrops, dropsToXrp } from "xrpl";126import { createConnectRouter } from "@connectrpc/connect";127128import { AccountService } from "./services/account";129```130131#### eth-contracts132133```typescript134import * as path from "path";135136import { ethers } from "ethers";137138import { TokenService } from "./services/token";139```140141## Auto-Generated Files142143**DO NOT EDIT:**144145| App | Generated Files |146| ---------------- | ---------------------------------------------------------------- |147| xrpl-grpc-server | `apps/xrpl-grpc-server/src/protogen/` (Buf/ConnectRPC generated) |148| eth-contracts | `apps/eth-contracts/build/` (Truffle build artifacts) |149150## Security151152- No hardcoded secrets or API keys153- No sensitive data in logs154- Input validation at boundaries155- Use environment variables for configuration156157## Quick Checklist158159### xrpl-grpc-server (Active)160161- [ ] `bun run lint` passes162- [ ] `bun run format` applied163- [ ] `bun run typecheck` passes164- [ ] `bun run build` passes165- [ ] No `any` types (unless documented reason)166- [ ] Async errors properly handled167168### eth-contracts169170- [ ] `npm run lint-js` passes171- [ ] `npm run fmt` applied172- [ ] `npm run build` passes173- [ ] `npm run test-all` passes174175## Related Documentation176177- @apps/xrpl-grpc-server/README.md - xrpl-grpc-server documentation178- @apps/xrpl-grpc-server/docs/MIGRATION-GUIDE.md - Migration guide from ripple-lib179- @apps/xrpl-grpc-server/package.json - xrpl-grpc-server scripts180- @apps/eth-contracts/package.json - eth-contracts scripts181182## Related Skills183184- `typescript-development` - Full TypeScript workflow185- `solidity-development` - For Solidity contracts in eth-contracts186187## Related Rules188189- @.claude/rules/apps/bun.md - Bun runtime rules (use bun/bunx instead of npm/npx)190- @.claude/rules/apps/xrp-server.md - XRP server directory rules191
Also in hiromaily/go-crypto-wallet
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/agent-files.mdc · 126 | Cursor rules | lint-formatarchdo-notagent-behaviour | 77/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/documentation-language.mdc · 126 | Cursor rules | archdo-notdocs | 36/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/general.mdc · 126 | Cursor rules | buildtestarchgit+2 | 83/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/github-actions.mdc · 126 | Cursor rules | stylearchgitperformance+4 | 77/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/proto.mdc · 126 | Cursor rules | buildlint-formatstylearch+3 | 96/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/security.mdc · 126 | Cursor rules | archsecuritydo-notagent-behaviour | 76/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/shell-script.mdc · 126 | Cursor rules | setupteststylearch+1 | 73/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/ssot.mdc · 126 | Cursor rules | stylearchtypesdo-not+2 | 84/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/task-context-loading.mdc · 126 | Cursor rules | archtypesdatabasedo-not+1 | 93/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/yaml.mdc · 126 | Cursor rules | lint-formatstylearchtypes+3 | 84/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.github/copilot-instructions.md · 126 | Copilot instructions | teststylearchsecurity+1 | 56/100 | 3 days ago | |
| hiromaily/go-crypto-walletAGENTS.md · 126 | AGENTS.md | archtypesdo-notagent-behaviour+1 | 79/100 | 3 days ago | |
| hiromaily/go-crypto-walletCLAUDE.md · 126 | CLAUDE.md | archtypesdo-notagent-behaviour+1 | 79/100 | 3 days ago | |
| hiromaily/go-crypto-walletpkg/AGENTS.md · 126 | AGENTS.md | stylearchdo-not | 80/100 | 3 days ago |
Diff against .cursor/rules/agent-files.mdc Diff against .cursor/rules/documentation-language.mdc Diff against .cursor/rules/general.mdc Diff against .cursor/rules/github-actions.mdc Diff against .cursor/rules/proto.mdc Diff against .cursor/rules/security.mdc Diff against .cursor/rules/shell-script.mdc Diff against .cursor/rules/ssot.mdc Diff against .cursor/rules/task-context-loading.mdc Diff against .cursor/rules/yaml.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against CLAUDE.md Diff against pkg/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/proto.mdc · 126 | Cursor rules | buildlint-formatstylearch+3 | 96/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49 | Cursor rules | setupbuildteststyle+4 | 96/100 | 3 days ago | |
| K-Mistele/opensearch.cursor/rules/default.mdc · 30 | Cursor rules | buildtestlint-formatstyle+2 | 94/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/task-context-loading.mdc · 126 | Cursor rules | archtypesdatabasedo-not+1 | 93/100 | 3 days ago | |
| AsharibAli/ramadan-prompting-nights.cursor/rules/frontend.mdc · 29 | Cursor rules | setuptestlint-formatstyle+7 | 91/100 | 3 days ago |
