Always use multi-line if/else blocks. Never put the body on the same line as the condition:
// Bad
if (!el) { return; }
if (cls) { div.className = cls; }
// Good
if (!el) {
return;
}
if (cls) {
div.className = cls;
}The same applies to continue, break, and any other single-statement body:
// Bad
if (t === tab) { continue; }
// Good
if (t === tab) {
continue;
}Add a blank line after variable declarations before logic:
const t = e.target as HTMLElement;
if (t.closest(".terminal-content")) {
return;
}Add blank lines between logical blocks to let code breathe:
const content = document.getElementById("memory-content");
if (!content) {
return;
}
if (!isConnected) {
content.innerHTML = "...";
return;
}Exported functions and variables use camelCase: doConnect, openFileDialog,
switchToFile, scheduleSaveSettings.
Use plain ASCII only in code, comments, and strings. No Unicode arrows, em-dashes, fancy quotes, or other non-ASCII symbols.
Large HTML strings used as templates should be declared as constants at the top of their module, not inline in functions.
Use rustfmt defaults. No additional style rules beyond what rustfmt enforces.
- Tauri commands use
cmd_prefix (cmd_connect,cmd_list_ports) - Plain ASCII only in code and comments (same as TypeScript)