Skip to content

Function name camelCase (ARCH3002)

Key typescript.naming.function-name-camelcase · Severity warning · Category naming

Function declarations should use camelCase. PascalCase function names suggest a class or constructor, and snake_case violates TypeScript conventions.

function Calculate_total(items: number[]) {
return items.reduce((a, b) => a + b, 0);
}
function FetchUser(id: number) {
return db.find(id);
}
function calculateTotal(items: number[]) {
return items.reduce((a, b) => a + b, 0);
}
function fetchUser(id: number) {
return db.find(id);
}

Rename the function to camelCase: lowercase first letter, capitalized subsequent words.