code-standards
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Standards
代码规范
Write code that is accessible, performant, type-safe, and maintainable.
编写具备可访问性、高性能、类型安全且可维护的代码。
Activation Conditions
适用场景
- Linting errors need fixing
- Code formatting issues
- Code review feedback
- Questions about style guidelines
- 需要修复Linting错误
- 存在代码格式问题
- 收到代码评审反馈
- 对风格指南存在疑问
Quick Reference
快速参考
| Action | Rule |
|---|---|
| Write components | |
| Async code | |
| Avoid legacy libs | |
anynoExplicitAnyuseTopLevelRegex| 操作 | 对应规则 |
|---|---|
| 编写组件 | |
| 异步代码 | |
| 避免使用遗留库 | |
anynoExplicitAnyuseTopLevelRegexCommands
命令
bash
bun x ultracite fix # Format and fix
bun x ultracite check # Check for issues
bun x ultracite doctor # Diagnose setupbash
bun x ultracite fix # Format and fix
bun x ultracite check # Check for issues
bun x ultracite doctor # Diagnose setupQuick Fix
快速修复
Most issues are auto-fixed:
bash
bun x ultracite fix大部分问题都支持自动修复:
bash
bun x ultracite fixConsole Logging
控制台日志规则
- Never use ,
console.log, orconsole.debugin production codeconsole.info - Only use and
console.errorfor actionable errorsconsole.warn - For debug logging, wrap in
if (IsDev) { ... } - Don't use to suppress console warnings - remove the logs instead
biome-ignore
- 严禁在生产代码中使用 、
console.log或console.debugconsole.info - 仅可使用 和
console.error记录可处理的错误console.warn - 调试日志需要包裹在 代码块中
if (IsDev) { ... } - 不要使用 抑制控制台警告,应当直接移除相关日志
biome-ignore
Rules
详细规则
See directory for detailed guidance.
rules/查看 目录获取详细指引。
rules/