Skip to content

[docs] add code quality guidelines for i18n, async cleanup, and error handling #4305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2025

Conversation

christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Jun 30, 2025

Adds best practice guidelines to CLAUDE.md based on common code review feedback patterns. These guidelines help ensure consistent code quality across the codebase by emphasizing proper i18n usage, async operation cleanup, and user-friendly error messaging.

┆Issue is synchronized with this Notion page by Unito

@christian-byrne christian-byrne requested a review from a team as a code owner June 30, 2025 19:08
CLAUDE.md Outdated
@@ -52,3 +52,7 @@
- Templates: `api.fileURL('/templates/default.json')`
- Extensions: `api.fileURL(extensionPath)` for loading JS modules
- Any static assets that exist in the public directory
- Sanitize dynamically generated HTML content or use templates instead of v-html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one reads as a little vaguely worded; "santitize" could likely be interpreted a few ways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I am not super sure, sorry - I've no context about what this was written in reaction to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had three features recently that injected raw html with v-html (node info side panel, release notification system, tooltips on usage log table). In all cases, the html strings are recieved from external source.

It wasn't a major issue in those three cases because the first santized with dom purify and the second two were from comfy-org endpoints, but it made me realize that this is a good thing to have CC watch out for when writing code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like:

If you are implementing code that will output raw, dynamically generated HTML (e.g. injecting a string that is assumed to be HTML), always ensure the dynamic content has been {{ validated / parsed / ... }}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

… review feedback

Replace vague "sanitize" wording with specific guidance on using DOMPurify
and validating trusted sources when using v-html directive
@christian-byrne christian-byrne force-pushed the docs/improve-code-quality-guidelines branch from 818d0cf to f10d0ac Compare July 2, 2025 00:00
@webfiltered webfiltered merged commit 8f825c0 into main Jul 2, 2025
10 checks passed
@webfiltered webfiltered deleted the docs/improve-code-quality-guidelines branch July 2, 2025 00:13
This was referenced Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants