Back to all reviewers

Use descriptive parameter names

vadimdemedes/ink
Based on 2 comments
TypeScript

Choose parameter names that clearly communicate their purpose and avoid confusion with similar concepts. Avoid generic or ambiguous names that could be misinterpreted.

Naming Conventions TypeScript

Reviewer Prompt

Choose parameter names that clearly communicate their purpose and avoid confusion with similar concepts. Avoid generic or ambiguous names that could be misinterpreted.

When naming parameters, consider:

  • What the parameter actually represents, not just its technical type
  • Whether the name could be confused with other common programming concepts
  • If the parameter type changes, update the name to match

Example of unclear naming:

export function useInput(
	inputHandler: (input: string, meta: Meta) => void

Better alternatives:

export function useInput(
	inputHandler: (input: string, metadata: InputMetadata) => void
	// or
	inputHandler: (input: string, key: KeyInfo) => void

The name meta is ambiguous because it could be confused with “meta keys” (a different keyboard concept), while metadata or key clearly indicate what the parameter contains.

2
Comments Analyzed
TypeScript
Primary Language
Naming Conventions
Category

Source Discussions