Last verified: 2026-03-07
All commands run from this plugin/ directory:
npm run dev- Development build with type checkingnpm run build- Production buildnpm run check- TypeScript type checking onlynpm run test- Run all tests (Vitest)npm run test ./src/utils- Run tests for specific directory/filenpm run lint:check- Check formatting and linting (BiomeJS)npm run lint:fix- Auto-fix formatting and linting issues
src/index.ts- Plugin entry point; initializes services, registers commandssrc/api/- Todoist REST API client and domain modelssrc/data/- Repository pattern for caching API data with syncsrc/query/- Custom query language parser andtodoistcode block renderersrc/ui/- React components (React 19 + React Aria Components + Framer Motion)src/services/- Business logic (token management, modal orchestration)src/commands/- Obsidian command definitionssrc/i18n/- Internationalization (interface intranslation.ts, implementations inlangs/)src/utils/- Shared utilities
- Repository pattern (
src/data/repository.ts): Generic caching layer that decouples UI from API fetch timing. All Todoist data flows through repositories. - Zustand for settings (
src/settings.ts): Reactive state management for plugin configuration, avoids prop drilling. - React Aria Components: Accessibility-first UI primitives. Prefer these over custom interactive elements.
- SCSS with component-scoped styles: Each component has co-located
.scss; supports Obsidian light/dark themes.
-
Always use translations for user-facing text - never hardcode strings in UI components
-
Import translations with
import { t } from "@/i18n"and useconst i18n = t().section -
For simple text: define as
stringin translation interface and return string value -
For text with interpolation: define as
(param: Type) => stringfunction in translation interface -
Example with interpolation:
// translation.ts deleteNotice: (itemName: string) => string; // en.ts deleteNotice: ((itemName: string) => `Item "${itemName}" was deleted`, // component.tsx new Notice(i18n.deleteNotice(item.name)));
-
Translation files are in
src/i18n/with interface intranslation.tsand implementations inlangs/
- Vitest with jsdom environment for React component testing
- Mocked Obsidian API (
src/mocks/obsidian.ts)