Naming conventions

Verze:

18. 06. 2025

Zodpovědná osoba:

Dominik Šlechta

Poslední aktualizace:

05. 01. 2026, dominikslechta.1@gmail.com

camelCase MUST be used for variables and functions. PascalCase MUST be used for types, classes, and constants.

camelCase for Variable Names and Function Names

  • Rule: camelCase MUST be used for variable names and function names.

  • Reason: camelCase is the standard for variable and function names in JavaScript. It improves consistency and readability within the codebase.

Example (Correct):

let userName = 'John'; 
function calculateTotal() {}

Example (Incorrect):

let UserName = 'John';
function CalculateTotal() {} 

PascalCase for Types and Classes

  • Rule: PascalCase MUST be used for types and classes.

  • Reason: PascalCase is the convention for class and type names. It helps distinguish them from variables and functions, and aligns with standard JavaScript practices for object-oriented programming.

Example (Correct):

class UserAccount {  
    constructor(name) {
        this.name = name;
    }
}

Example (Incorrect):

class userAccount {  
    constructor(name) {
        this.name = name;
    }
}

PascalCase for Constants

  • Rule: PascalCase MUST be used for constants.

  • Reason: PascalCase for constants maintains consistency with class naming conventions. Constants are distinguished by the const keyword rather than uppercase casing.

Example (Correct):

const MaxUsers = 100;
const ApiBaseUrl = 'https://api.example.com';

Example (Incorrect):

const MAX_USERS = 100;
const API_BASE_URL = 'https://api.example.com';

Summary:

  • Naming conventions: camelCase for variables/functions, PascalCase for classes/types, PascalCase for constants.