Back to all reviewers

Use descriptive identifiers

denoland/deno
Based on 3 comments
TypeScript

Choose names that clearly communicate the purpose, functionality, and usage context of variables, methods, and types. Avoid ambiguous or overly generic names that require additional context to understand.

Naming Conventions TypeScript

Reviewer Prompt

Choose names that clearly communicate the purpose, functionality, and usage context of variables, methods, and types. Avoid ambiguous or overly generic names that require additional context to understand.

When naming:

  • Include key functionality details in the name (e.g., readWithCancelHandle instead of a generic property)
  • Consider the visibility and intended usage pattern (e.g., use symbols or naming conventions to indicate internal/private methods)
  • Look to established conventions in similar libraries or codebases when uncertain
  • If a name is causing confusion or debate, consider whether the abstraction itself needs restructuring

Example from codebase:

// Instead of unclear property access:
if (this[kStreamBaseField]![_readCancel]) {

// Use descriptive method name:
if (this[kStreamBaseField]!.readWithCancelHandle()) {

Good naming reduces the need for comments and makes code self-documenting, improving maintainability and reducing cognitive load for other developers.

3
Comments Analyzed
TypeScript
Primary Language
Naming Conventions
Category

Source Discussions