Back to all reviewers

Use contextually descriptive names

mastodon/mastodon
Based on 5 comments
TSX

Names should clearly indicate their purpose and context to avoid confusion, especially when similar concepts exist in the same scope. Generic names like "api", "params", or "arg1" create ambiguity and make code harder to understand. Instead, use specific, meaningful identifiers that describe what they represent or do.

Naming Conventions TSX

Reviewer Prompt

Names should clearly indicate their purpose and context to avoid confusion, especially when similar concepts exist in the same scope. Generic names like “api”, “params”, or “arg1” create ambiguity and make code harder to understand. Instead, use specific, meaningful identifiers that describe what they represent or do.

Examples of improvements:

  • Change generic labels like “expand”/”collapse” to contextual ones like “Expand/collapse lists menu”
  • Replace confusing names like params (which resembles useParams hook) with descriptive alternatives like target
  • Use meaningful parameter names like index instead of generic arg1, arg2
  • Replace non-specific names like api with descriptive alternatives that indicate their actual purpose

This practice becomes especially important when multiple similar concepts exist in the same scope, as clear naming prevents confusion and improves code maintainability.

5
Comments Analyzed
TSX
Primary Language
Naming Conventions
Category

Source Discussions