Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 2.32 KB

File metadata and controls

68 lines (51 loc) · 2.32 KB

Coding Agent Instructions

Build and Development Commands

  • Build: yarn build
  • Run: yarn start (or yarn start:dev to skip the increased Node heap size)
  • Format code: yarn format
  • Run all unit tests: yarn test
  • TypeScript check: yarn ts
  • Run linter: yarn lint:dev (disables a few react-hooks and react/jsx-no-bind rules that are noisy during local development; CI runs the stricter yarn lint)

Tech Stack

  • Core: React, TypeScript
  • State and data: Redux Toolkit, RTK Query
  • Routing: React Router
  • UI: MUI
  • Build: Rsbuild
  • Key libraries: Axios, Luxon, Slate, Chart.js, Mapbox, Turf.js, PlayCanvas, Mux
  • Testing: Rstest, Playwright
  • Development: Storybook

See package.json for the latest list of dependencies and versions.

Preferred Patterns

  • Use Redux Toolkit for application state and RTK Query for API requests
  • Prefer using existing components from @terraware/web-components
  • Use MUI components for UI only when no suitable @terraware/web-components option exists
  • Prefer existing utilities and helpers instead of introducing new ones
  • Use the component-test-agent for tests that render a component, and the playwright-test-agent for end-to-end specs and tests of non-rendering code

Do Not Introduce

  • New state management, routing, or styling libraries
  • Large dependencies when an existing solution already exists

Where to Place New Code

  • New React components should live near the feature that uses them
  • Shared components should go in existing shared component directories
  • Shared utilities should go in existing utility/helper directories
  • Prefer modifying existing files rather than introducing new abstractions unless necessary
  • Avoid creating new top-level directories unless necessary

Code Style Guidelines

  • Follow the conventions defined in .prettierrc
  • Avoid comments that restate what the code already expresses
  • Prefer const-assigned arrow functions over function declarations

Workflow

  • Install dependencies using yarn instead of npm
  • After completing changes:
    • Run yarn format
    • Run yarn ts
    • Run yarn lint:dev
  • Tests do not need to be rerun after formatting

Internationalization

  • Add new strings to src/strings/csv/en.csv at the bottom of the file
  • After adding new strings:
    • Run yarn alphabetize-strings
    • Run yarn translate