naming-format

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
You are a naming conventions expert. Infer the project's language variant (US/UK English) from existing commits, docs, and code, and match it in all output.
Read individual rule files in
rules/
for detailed explanations and examples.
你是一名命名规范专家。从现有提交记录、文档和代码中推断项目所使用的英语变体(美式/英式),并在所有输出中保持一致。
请阅读
rules/
目录下的单个规则文件,以获取详细说明和示例。

Rules Overview

规则概览

RuleImpactFile
Case consistencyHIGH
rules/case-consistency.md
File suffixesHIGH
rules/file-suffixes.md
Export namingHIGH
rules/export-naming.md
Index filesHIGH
rules/index-files.md
Framework conventionsMEDIUM
rules/framework-conventions.md
规则影响程度文件
大小写一致性
rules/case-consistency.md
文件后缀
rules/file-suffixes.md
导出命名
rules/export-naming.md
索引文件
rules/index-files.md
框架规范
rules/framework-conventions.md

Workflow

工作流程

Step 1: Detect

步骤1:检测

Scan the project to identify:
  • Dominant filename casing convention (count files by pattern)
  • Framework indicators in
    package.json
    (Next.js, Expo, etc.)
  • Existing suffix patterns (
    .test.ts
    vs
    .spec.ts
    , etc.)
  • Export naming patterns across the codebase
扫描项目以识别:
  • 占主导地位的文件名大小写规范(按模式统计文件数量)
  • package.json
    中的框架标识(Next.js、Expo等)
  • 现有后缀模式(如
    .test.ts
    .spec.ts
    等)
  • 代码库中的导出命名模式

Step 2: Audit

步骤2:审计

Check all files and exports against the rules. Report violations grouped by rule:
undefined
对照规则检查所有文件和导出项。按规则分组报告违规情况:
undefined

Naming Audit Results

命名审计结果

HIGH Severity

高严重程度

  • src/components/userProfile.tsx
    - File should be
    user-profile.tsx
    (kebab-case)
  • src/hooks/UseAuth.ts
    - Hook export
    UseAuth
    should be
    useAuth
    (camelCase with
    use
    prefix)
  • src/components/userProfile.tsx
    - 文件应命名为
    user-profile.tsx
    (短横线分隔命名法)
  • src/hooks/UseAuth.ts
    - Hook导出
    UseAuth
    应改为
    useAuth
    (以
    use
    为前缀的小驼峰命名法)

MEDIUM Severity

中严重程度

  • src/utils/index.ts
    - Barrel file with 12 re-exports → use direct imports
  • src/utils/index.ts
    - 包含12个重导出的桶文件 → 使用直接导入

Summary

摘要

RuleViolationsFiles
Case consistencyXN
Export namingYN
TotalX+YN
undefined
规则违规数量文件数
大小写一致性XN
导出命名YN
总计X+YN
undefined

Step 3: Fix

步骤3:修复

Apply fixes for each violation:
  1. Rename files using
    git mv
    to preserve git history
  2. Update all import paths in dependent files using Edit
  3. Verify no broken imports remain after renames
对每个违规项应用修复:
  1. 使用
    git mv
    重命名文件,以保留Git历史记录
  2. 使用编辑功能更新所有依赖文件中的导入路径
  3. 验证重命名后是否存在无效导入