Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.31 KB

File metadata and controls

53 lines (36 loc) · 1.31 KB

Code

TypeScript

  • Strict typing
  • Use type instead of interface for type definitions
  • Never cast types using const x = y as unknown as SomeType patterns
  • Allow non-null assertions (!), but document why it's justified
  • Do not add return type annotation to React components

Import groups

  1. External libraries
  2. @skybrush libraries
  3. Internal modules with ~/ (alias for ./src/*)
  4. Relative imports

Exports

  • Named exports for utilities and non-React components
  • Default export for React components

React

  • Use function components declared with const Comp = () => {} pattern
  • Prop types defined as TypeScript types
  • Redux-connected components: non-connected version with a standard name, connected component with "Connected" prefix
  • Avoid complex UI sections within a component

I18n

  • All UI text must be internationalized
  • Never concatenate translated strings, use interpolation in the i18n resource

Redux

  • Redux Toolkit patterns
  • Non-trivial selectors with createSelector

General

Never (unless told to):

  • Build or run the project
  • Run or add tests
  • Output explanations or unnecessary code snippets

Always:

  • Fully understand the task and the related code before getting to work
  • If something is unclear, ask for input
  • Follow clean code principles
  • Be succint