Skip to main content

Overview

New Expensify follows strict coding standards to maintain code quality and consistency across the codebase.
Read the complete STYLE.md guide in the repository for comprehensive style guidelines.

Code Quality Tools

1. TypeScript

All code must be written in TypeScript with strict mode enabled.

2. ESLint

All code must pass ESLint with zero warnings.

3. Prettier

MANDATORY: All code must be formatted with Prettier before committing.
CI will reject PRs with improperly formatted code. Always run Prettier before committing.

Post-Edit Checklist

Run these commands before every commit:

TypeScript Guidelines

Type Definitions

Avoid Type Assertions

Use Utility Types

Naming Conventions

Files

Variables and Functions

Components

Constants

Component Patterns

Functional Components with Types

Memoization

Props Destructuring

Styling Guidelines

Use Theme and Styles Hooks

StyleSheet

Combining Styles

Import Organization

React Patterns

Hooks

Conditional Rendering

Lists and Keys

Performance Best Practices

Avoid Inline Functions

Use FlashList for Long Lists

Avoid Unnecessary Re-renders

Error Handling

Try-Catch Blocks

Logging

Comments

When to Comment

JSDoc for Complex Functions

Testing Standards

See Testing Guidelines for comprehensive testing standards.

Basic Test Structure

Git Commit Standards

Commit Messages

Commit Signing

All commits must be signed:

Common Anti-Patterns

1. Mutating State

2. Side Effects in Render

3. Missing Dependencies

Platform-Specific Code

Accessibility

Internationalization

Documentation

  • Complex logic: Add comments explaining WHY
  • Public APIs: Use JSDoc
  • New patterns: Document in CONTRIBUTING.md
  • Breaking changes: Update relevant docs

Next Steps

Testing

Learn testing best practices

Pull Requests

Submit quality PRs

Architecture

Understand the codebase structure

Style Guide

Complete style guide