Skip to main content

NAME-002: Functions and Methods Must Use camelCase

AttributeValue
CategoryNaming Standards
Default Severityinfo
Applicable FilesAll TypeScript/JavaScript files

Why It Exists (Rationale)​

camelCase is the idiomatic standard for function, method, and variable names in JavaScript and TypeScript. Consistent casing:

  • Eliminates stylistic debate across teams and PR reviews.
  • Differentiates callable instances and functions from class constructors (PascalCase) and constants (UPPER_SNAKE_CASE).
  • Preserves clean interop across open-source libraries and frameworks.

Bad Example​

// ❌ snake_case or PascalCase function names
function Calculate_Tax(amount: number): number {
return amount * 0.2;
}

class InvoiceService {
Generate_Monthly_Invoice() {
// ...
}
}

Good Example​

// ✅ camelCase function and method names
function calculateTax(amount: number): number {
return amount * 0.2;
}

class InvoiceService {
generateMonthlyInvoice() {
// ...
}
}

How It's Detected​

ArchStandards extracts function declarations and class methods from the AST (skipping constructors and private fields) and asserts that identifiers match ^[a-z][a-zA-Z0-9]*$.

Exception Configuration​

exceptions:
- rule: "NAME-002"
path: "src/database/migrations/**"
reason: "Database migration hooks follow framework-specific snake_case conventions."