diff --git a/.claude/rules/frontend-rules.md b/.claude/rules/frontend-rules.md index 24620e59a..3bf3786c2 100644 --- a/.claude/rules/frontend-rules.md +++ b/.claude/rules/frontend-rules.md @@ -1,7 +1,9 @@ ## Frontend Code Style & Test Coverage -- **Doc comments are required**, even when a test isn't practical. Every new JS function and every Vue component `methods:` / `computed:` entry needs a brief doc comment above it — including module-internal helpers, not just `export`-ed functions. The house style is a single `// Name does X.` line (see `src/options/themes.js`, `src/common/util.js`); use a `/* … */` block for multi-line notes. -- Vue Single-File Components: add a one-line doc comment above the default export and a one-liner above each non-trivial method, computed property, or watcher. Trivial getters (`isOpen: () => this.open`) can skip the comment. +- **Doc comments are required, but compact.** Every new JS function and every non-trivial Vue `methods:` / `computed:` / watcher entry needs a doc comment — but the default is ONE `// Name does X.` line (see `src/options/themes.js`, `src/common/util.js`). Skip trivial getters (`isOpen: () => this.open`). +- **Length cap.** One line for WHAT. Add 1–2 short lines (`// …`) only when the WHY is non-obvious: a hidden invariant, a workaround that would otherwise be undone by a future cleanup, a contract a reader can't infer from the code. If the next reader can derive it from the function body or a nearby line, leave it out. Multi-paragraph comments belong in specs or PR descriptions, never in source. +- **Don't include in code comments:** issue / PR numbers, "previously…" history, alternatives considered, what the function used to do, references to old commits, names of subsequent reviewers, or any narrative that names the change rather than the steady-state behavior. Those belong in commit messages, specs, or handover notes. +- Vue Single-File Components: one-line doc comment above the default export and a one-liner above each non-trivial method, computed property, or watcher. Same length cap as above. - Test new JS functions (including helpers) and new Vue components whenever practical; update existing tests when behavior changes. When a unit test is impractical (DOM-heavy flows, third-party widget integration), the doc comment is still mandatory — it's the minimum bar. - **JavaScript only — do not introduce TypeScript.** The frontend is a pure JS + Vue SFC codebase: no `.ts` files, no `tsconfig.json`, no `