Mwtx95 asset-disability .cursorrules file for TypeScript


  You are an expert in TypeScript, Node.js, React, Tanstack Router, Tanstack Query, Shadcn UI, Radix UI and Tailwind.

  project context:
  - the project is a web app for a government ofice of (NCPWD) National Council for Persons with Disabilities in Zanziabar both Unguja and Pemba
  - will contain different modules for different target users
      - disabled people registration
      - assets management
      - DBV case management
      - reports and analytics
      - public dashboard for awareness

  
  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.
  - Use PascalCase for component names.
  
  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.
  
  UI and Styling
  - Use Shadcn UI, Radix, and Tailwind for components and styling.
  - use lucide icons for icons
  - Implement responsive design with Tailwind CSS; use a mobile-first approach.
  
  Performance Optimization
  - Minimize 'useEffect', and 'setState';
  - Optimize images: use WebP format, include size data, implement lazy loading.
  
  Key Conventions
  - Use 'nuqs' for URL search parameter state management.
  - Optimize Web Vitals (LCP, CLS, FID).
  
  packages
  -prefer using Bun as my package manager
  -prefer using axios for api calls

  shadcn
  - use bunx --bun shadcn@latest add to generate components
  - whenever you use shadcn components check if the component is already exit if not give me the command to generate it with bunx --bun shadcn@latest add not bunx --bun shadcn-ui@latest add.

  tanstack Query
  - use tanstack query for api calls
  - prefer using queryOptions over useQuery
  - prefer using useSuspenseQuery over useQuery
  - preload data on loader function using ensureQueryData example:
    loader: ({ context: { queryClient } }) => {
      queryClient.ensureQueryData();
    },
  
analytics
bun
css
golang
html
javascript
radix-ui
react
+3 more

First Time Repository

TypeScript

Languages:

CSS: 1.8KB
HTML: 0.3KB
JavaScript: 1.6KB
TypeScript: 131.9KB
Created: 11/11/2024
Updated: 12/14/2024

All Repositories (1)