Code Style Guide

Coding standards and style guidelines for Gconv Prune

TypeScript Guidelines

Type Definitions

// Good
type User = {
  id: string;
  name: string;
  email: string;
  role: "admin" | "user";
};

// Bad
type User = {
  id: any;
  name: any;
  email: any;
  role: string;
};

React Components

Component Structure

import React from "react";

type Props = {
  title: string;
  children: React.ReactNode;
};

export function MyComponent({ title, children }: Props) {
  return (
    <div>
      <h1>{title}</h1>
      {children}
    </div>
  );
}

Naming Conventions

  • Use PascalCase for component names
  • Use camelCase for variables and functions
  • Use UPPER_SNAKE_CASE for constants
  • Use kebab-case for file names

Code Organization

File structure:

  • Group related files in feature directories
  • Keep components close to where they are used
  • Separate business logic from UI components
  • Use barrel exports (index.ts) for public APIs

Need Help?

For code style questions, check our troubleshooting guide or contact our support team.