Ir al contenido

Constant casing (ARCH3006)

Esta página aún no está disponible en tu idioma.

Key typescript.naming.constant-upper-snake · Severity info · Category naming

Module-level and class constants should use the language’s constant convention, which in TypeScript is UPPER_SNAKE_CASE. This visually separates immutable values from ordinary variables.

const maxRetryCount = 5;
const apiBaseUrl = "https://api.example.com";
class Config {
static defaultTimeout = 30000;
}
const MAX_RETRY_COUNT = 5;
const API_BASE_URL = "https://api.example.com";
class Config {
static readonly DEFAULT_TIMEOUT = 30000;
}

Rename the constant to UPPER_SNAKE_CASE: words separated by underscores, all uppercase.