jaronheard soonlist-turbo .cursorrules file for TypeScript (stars: 3)

You are an expert in TypeScript, Node.js, Next.js App Router, React, Expo, tRPC, Shadcn UI, Radix UI, and Tailwind.

Code Style and Structure:

- Write concise, technical TypeScript code with accurate examples
- Use functional and declarative programming patterns; avoid classes
- Prefer iteration and modularization over code duplication
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
- Structure files: exported component, subcomponents, helpers, static content, types

Naming Conventions:

- Use lowercase with dashes for directories (e.g., components/auth-wizard)
- Favor named exports for components

TypeScript Usage:

- Use TypeScript for all code; prefer interfaces over types
- Avoid enums; use maps instead
- Use functional components with TypeScript interfaces

Syntax and Formatting:

- Use the "function" keyword for pure functions
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
- Use declarative JSX
- Always specify types for props and return values
- Use async/await for asynchronous code, and use void where appropriate

Error Handling and Validation:

- Prioritize error handling: handle errors and edge cases early
- Use early returns and guard clauses
- Implement proper error logging and user-friendly messages
- Use Zod for form validation
- Model expected errors as return values in Server Actions
- Use error boundaries for unexpected errors

UI and Styling:

- Use Shadcn UI, Radix, and Tailwind for components and styling in the Next.js app
- Use NativeWind for styling in the Expo app
- Implement responsive design with Tailwind CSS; use a mobile-first approach

Key Conventions:

- Use tRPC for type-safe API calls between client and server
- Implement Clerk for authentication in both Next.js and Expo apps
- Use Lucide icons for Next.js (lucide-react) and Expo (lucide-react-native)
- Implement error tracking with Sentry in both apps
- Use Tanstack Query (React Query) for data fetching and caching
- Implement Expo Router for navigation in the mobile app
- Use Expo notifications for push notifications in the mobile app

Performance Optimization:

- Use dynamic loading for non-critical components
- Optimize images: use WebP format, include size data, implement lazy loading

Next.js Specific:

- Follow Next.js App Router conventions for routing and data fetching
- Use Server Components where possible to reduce client-side JavaScript
- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC)
- Wrap client components in Suspense with fallback

Expo Specific:

- Use Expo SDK features like expo-secure-store, expo-notifications, etc.
- Implement expo-router for navigation
- Use react-native specific components and APIs
- Optimize performance using React Native best practices
- Use Zustand for client-side state management with a single global store

Follow Next.js and Expo documentation for best practices in data fetching, rendering, and routing.
clerk
css
java
javascript
next.js
radix-ui
react
sentry
+6 more

First Time Repository

Organize possibilities

TypeScript

Languages:

CSS: 5.4KB
JavaScript: 12.1KB
Swift: 5.5KB
TypeScript: 986.5KB
Created: 4/26/2024
Updated: 1/20/2025

All Repositories (1)

Organize possibilities