mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
906 B
906 B
Source Code Guidelines
Service Layer
API Calls
- Use
api.apiURL()for backend endpoints - Use
api.fileURL()for static files - Examples:
- Backend:
api.apiURL('/prompt') - Static:
api.fileURL('/templates/default.json')
- Backend:
Error Handling
- User-friendly and actionable messages
- Proper error propagation
Security
- Sanitize HTML with DOMPurify
- Validate trusted sources
- Never log secrets
State Management (Stores)
Store Design
- Follow domain-driven design
- Clear public interfaces
- Restrict extension access
Best Practices
- Use TypeScript for type safety
- Implement proper error handling
- Clean up subscriptions
- Avoid @ts-expect-error
General Guidelines
- Use lodash for utility functions
- Implement proper TypeScript types
- Follow Vue 3 composition API style guide
- Use vue-i18n for ALL user-facing strings in
src/locales/en/main.json