Instruction file imported from dxos/dxos (
.cursor/rules/dxos.mdc). Copyright stays with the author.
DXOS Rules
Key preferences:
- Write in TypeScript by default.
- Prefer functional programming patterns.
- Follow React best practices and hooks patterns.
- Use TailwindCSS for React styles.
- Unit test examples when relevant.
When writing code:
- Include type definitions.
- Add JSDoc comments for public functions.
- Keep components pure and composable.
- Use proper error handling with Effect; never put untyped
Errorin an Effect's error type parameter — useBaseError.extendorData.TaggedClass. - Include proper event handler types for React components.
- All comments should be in English and end with a period.
Technologies to consider:
- Use Effect-TS for schema validation.
- Automerge for state management.
- Codemirror v6 for editor integrations.
Monorepo tools:
- moon for monorepo management.
- pnpm for package management.
- vitest
- vite
Testing:
- Place test files near the module they test with "module_name.test.ts" format.
- Use vitest with
describeandtestapis (don't useit).it.effectis an exception to this rule. - Don't write tests at top-level, instead make sure they are wrapped in a
describeblock. - Prefer importing
expectfrom test context:test('foo', ({ expect }) => ...) - File layout: suite config first (
beforeEach/afterEach, shared fixtures), then tests. Put helper functions at the bottom of the test file, after the closingdescribe— never between imports and the suite. - Test body layout: setup at the top of each test (
peer,db,queues,testLayer, etc.), then the scenario and assertions.