feat: add ESLint and Prettier with pre-commit hook

- Install ESLint 9 with TypeScript and React support
- Install Prettier with custom configuration (no semicolons)
- Add husky and lint-staged for pre-commit hooks
- Configure lint-staged to auto-fix and format on commit
- Relax ESLint rules to avoid large-scale code changes
- Format all existing code with Prettier (no semicolons)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
Ember
2025-11-05 11:30:27 +08:00
parent c276eba151
commit 4978f9e8b8
44 changed files with 9619 additions and 3482 deletions

View File

@@ -12,7 +12,7 @@ export const TRADER_COLORS = [
'#a78bfa', // violet-400
'#4ade80', // green-400
'#fb7185', // rose-400
];
]
/**
* 根据trader的索引位置获取颜色
@@ -24,8 +24,8 @@ export function getTraderColor(
traders: Array<{ trader_id: string }>,
traderId: string
): string {
const traderIndex = traders.findIndex((t) => t.trader_id === traderId);
if (traderIndex === -1) return TRADER_COLORS[0]; // 默认返回第一个颜色
const traderIndex = traders.findIndex((t) => t.trader_id === traderId)
if (traderIndex === -1) return TRADER_COLORS[0] // 默认返回第一个颜色
// 如果超出颜色池大小,循环使用
return TRADER_COLORS[traderIndex % TRADER_COLORS.length];
return TRADER_COLORS[traderIndex % TRADER_COLORS.length]
}