Back to all reviewers

Collections use plural names

elie222/inbox-zero
Based on 2 comments
TSX

Always use plural names for properties representing collections (arrays/lists) in interfaces, types, and destructuring patterns. This ensures consistency between interface definitions and their usage throughout the codebase.

Naming Conventions TSX

Reviewer Prompt

Always use plural names for properties representing collections (arrays/lists) in interfaces, types, and destructuring patterns. This ensures consistency between interface definitions and their usage throughout the codebase.

Example:

// โŒ Inconsistent naming
interface DigestEmailProps {
  newsletter?: EmailItem[];  // singular for array
  receipt?: EmailItem[];     // singular for array
}

// โœ… Consistent plural naming
interface DigestEmailProps {
  newsletters?: EmailItem[];  // plural matches array type
  receipts?: EmailItem[];    // plural matches array type
}

// Usage remains consistent with interface
const { newsletters, receipts } = props;

This convention:

  • Makes array types immediately recognizable
  • Prevents confusion between single items and collections
  • Reduces bugs from property name mismatches
  • Follows common JavaScript/TypeScript conventions
2
Comments Analyzed
TSX
Primary Language
Naming Conventions
Category

Source Discussions