Formatting
Cross-cutting whitespace and comment rules for all files. Language/framework-specific structure lives in vue, typescript, file-organization; how to write a skill doc lives in skill-authoring. This skill owns only spacing and comments.
Blank Lines
- No blank lines between consecutive
constassignments — group them tightly. - No blank line before a
returnthat immediately follows aconstin a small function (including composables that return a function directly —returnfollows the last setup line with no gap). - Blank line after a closing
}of anif/for/block statement — unless it is the last statement in its scope or immediately followed by another opening block. (Exception: consecutive top-levelwatch/lifecycle-hook registrations in a Vue<script setup>each get a blank line between them — thevueskill,references/lifecycle-and-ssr.md.) - Blank line between an SFC's top-level blocks — written by
vize fmt, which formats every component (pnpm format); the split between the two formatters isopenspec/specs/architecture/lint-toolchain/design.md's. - No blank lines within Vue templates. A blank line inserted to visually separate template sections is a smell that the component owns more than one responsibility — extract each section into its own focused child component rather than spacing them apart. See the
vue-page-compositionskill (references/granularity.md). - Imports — order and blank lines are oxfmt's
sortImports(packages/configuration/oxfmt/oxfmtConfiguration.ts), applied on every format.internalPattern: []is what collapses every source (external-pkg,#shared,@vueuse/*,#src/) into one bucket per kind, so the formatter produces a contiguousimport typegroup, one blank line, then a contiguous value group. Don't hand-place import blank lines.
Object Literals
An object literal that fits the width is on one line — the shared objectWrap: "collapse" decides it, in a component too, and an inline snapshot is the one place it does not reach (references/object-literals.md).
Comments
comments/no-trailing-commentenforces that a//comment sits on its own line _above_ the code it describes. Own-line comments read consistently, survive the capitalization hook, and don't push lines past the width limit. The rule passes the two shapes that share a line by design: a same-line disable directive, and the comment the formatter itself hangs after a ternary's?or:.- No blank line before or after a
//comment — it attaches to its code and is the separator, at module scope too; consecutive//lines are one block, and deleting a leading comment puts its blank line back. Test files keep theirs (references/comment-placement.md). - Comment only _exceptional_ behaviour — never restate a convention a skill or doc already holds (
references/comment-content.md). - Comments describe the present, never the history; git is the changelog (
references/comment-content.md). - A backticked name in a comment is a claim the code holds it, checked like a page's citation: a name an external system declares is written in quotes (
"GITHUB_ENV"), and an invented example takes a placeholder stem (theopenspecskill,references/moves-and-renames.md). - A comment explains the code, never the change that produced it (
references/comment-content.md). /** */is for a module-scope paragraph and for an exported API surface that already carries one;//for everything else, an export included (references/doc-blocks.md).- Tight and generic — no baked-in example values; an actual error text a workaround addresses is kept (
references/comment-content.md). - Every comment line fits the formatter's print width, 120 columns —
comments/no-over-width-commentreads the width fromPRINT_WIDTHin the shared oxfmt configuration, since oxfmt never wraps a comment. A wrapped//comment opens each continuation line on a capital, ascapitalized-commentsrequires, and a directive too long for one line becomes a block comment whose reason continues below it. A rewrap refills only its own paragraph and joins no separate lines (references/capitalized-comments.md). oxlint reads no template, so an HTML comment in a.vuetemplate is measured byscripts/src/workspace/templates/templateCommentWidths.test.ts, against the samePRINT_WIDTH. - Don't fight oxlint's
capitalized-comments— after a rewrap, move an identifier off the line front and re-read the joined sentence (comments/no-capitalized-identifier,references/capitalized-comments.md).
Line Endings
- Enforced by
.gitattributes(* text=auto eol=lf— every text file checks out LF whatever "core.autocrlf" says on the machine;.bat/.cmd/.ps1are deliberatelycrlf) and settled by the formatters (pnpm format). Never hand-convert line endings.
Deep Dives
references/comment-placement.md— when placing a comment against its code, a blank line, another comment, or in a test file.references/comment-content.md— when writing or reviewing what a comment says.references/doc-blocks.md— when choosing between/** */and//.references/object-literals.md— when an object literal could fit one line, or sits in an inline snapshot.references/capitalized-comments.md— whencapitalized-commentsfires, or after rewrapping a comment block.