Back to all reviewers

Use semantically accurate names

ChatGPTNextWeb/NextChat
Based on 3 comments
TypeScript

Variable, method, and type names should precisely reflect their actual content, purpose, or scope. Names that misrepresent what they contain or do create confusion and make code harder to understand and maintain.

Naming Conventions TypeScript

Reviewer Prompt

Variable, method, and type names should precisely reflect their actual content, purpose, or scope. Names that misrepresent what they contain or do create confusion and make code harder to understand and maintain.

Ensure that:

  • Type names match their actual structure (use PartialLocaleType for partial implementations, not the full LocaleType)
  • Variable names correspond to their context (use const no: LocaleType for Norwegian locale, not const en: LocaleType)
  • Parameter purposes are clear through naming and explicit defaults

Example of problematic naming:

// Misleading - suggests full locale but may be partial
import { LocaleType } from "./index";

// Confusing - Norwegian locale named as English
const en: LocaleType = {
  // Norwegian translations...
};

Example of semantically accurate naming:

// Clear - indicates partial implementation
import { PartialLocaleType } from "./index";

// Accurate - matches the actual locale
const no: LocaleType = {
  // Norwegian translations...
};

// Explicit default parameter
export function getHeaders(ignoreHeaders: boolean = false) {
  // ...
}

This practice makes code self-documenting and reduces cognitive load when reading and maintaining the codebase.

3
Comments Analyzed
TypeScript
Primary Language
Naming Conventions
Category

Source Discussions