Back to all reviewers

Consistent naming patterns

prowler-cloud/prowler
Based on 5 comments
TypeScript

Follow systematic naming conventions for types, interfaces, and functions to enhance code readability and navigability: ### Type/Interface Naming - `*Data`: Full API models with `id`, `type`, `attributes`, `relationships` (e.g., `RoleData`)

Naming Conventions TypeScript

Reviewer Prompt

Follow systematic naming conventions for types, interfaces, and functions to enhance code readability and navigability:

Type/Interface Naming

  • *Data: Full API models with id, type, attributes, relationships (e.g., RoleData)
  • *Attributes: Only the attributes section of an object (e.g., RoleAttributes)
  • *Props: React component props (e.g., UserInfoProps)
  • *FormValues, *Params: Form schemas or context-specific helper types

Function Naming

  • Start with action verb (e.g., get, create)
  • Follow with domain/feature name and resource
  • Place adjectives before nouns (e.g., getLatestFindings not getFindingsLatest)

Use Typed Constants

  • Prefer enums over string literals for keys and constants
// โŒ Avoid
interface Role { id: string; type: "roles"; attributes: { /* ... */ }; }
const getFindingsLatest = async () => { /* ... */ };
type CredentialsForm = { aws_access_key_id: string; /* string literals */ };

// โœ… Better
interface RoleData { id: string; type: "roles"; attributes: RoleAttributes; }
interface RoleAttributes { /* ... */ }
const getLatestFindings = async () => { /* ... */ };
enum CredentialKeys { AwsAccessKey = "aws_access_key_id" /* ... */ }

This systematic naming makes the code more self-documenting and helps developers quickly distinguish between different types of interfaces when reading or searching through the codebase.

5
Comments Analyzed
TypeScript
Primary Language
Naming Conventions
Category

Source Discussions