mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
[docs] add code quality guidelines for i18n, async cleanup, and error handling (#4305)
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
- Use Suspense for async components
|
- Use Suspense for async components
|
||||||
- Implement proper error handling
|
- Implement proper error handling
|
||||||
- Follow Vue 3 style guide and naming conventions
|
- Follow Vue 3 style guide and naming conventions
|
||||||
- Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json.
|
- IMPORTANT: Use vue-i18n for ALL user-facing strings - no hard-coded text in services/utilities. Place new translation entries in src/locales/en/main.json
|
||||||
- Avoid using `@ts-expect-error` to work around type issues. We needed to employ it to migrate to TypeScript, but it should not be viewed as an accepted practice or standard.
|
- Avoid using `@ts-expect-error` to work around type issues. We needed to employ it to migrate to TypeScript, but it should not be viewed as an accepted practice or standard.
|
||||||
- DO NOT use deprecated PrimeVue components. Use these replacements instead:
|
- DO NOT use deprecated PrimeVue components. Use these replacements instead:
|
||||||
* `Dropdown` → Use `Select` (import from 'primevue/select')
|
* `Dropdown` → Use `Select` (import from 'primevue/select')
|
||||||
@@ -52,3 +52,7 @@
|
|||||||
- Templates: `api.fileURL('/templates/default.json')`
|
- Templates: `api.fileURL('/templates/default.json')`
|
||||||
- Extensions: `api.fileURL(extensionPath)` for loading JS modules
|
- Extensions: `api.fileURL(extensionPath)` for loading JS modules
|
||||||
- Any static assets that exist in the public directory
|
- Any static assets that exist in the public directory
|
||||||
|
- When implementing code that outputs raw HTML (e.g., using v-html directive), always ensure dynamic content has been properly sanitized with DOMPurify or validated through trusted sources. Prefer Vue templates over v-html when possible.
|
||||||
|
- For any async operations (API calls, timers, etc), implement cleanup/cancellation in component unmount to prevent memory leaks
|
||||||
|
- Extract complex template conditionals into separate components or computed properties
|
||||||
|
- Error messages should be actionable and user-friendly (e.g., "Failed to load data. Please refresh the page." instead of "Unknown error")
|
||||||
|
|||||||
Reference in New Issue
Block a user