Format Code
Format all code files using the project's formatters and verify results.
Usage
cursor
/format
Steps
- •
Run formatters
- •Execute
pnpm formatwhich runs:- •Biome for TypeScript/JavaScript/JSON
- •Prettier for Astro/Svelte/Markdown/CSS
- •Execute
- •
Show what changed
- •Run
git diff --statto show summary of reformatted files - •List the number of files modified
- •Run
- •
Verify formatting
- •Run
pnpm format:checkto confirm all files pass - •Report any files that still have formatting issues
- •Run
Formatter Configuration
| File Types | Tool | Config |
|---|---|---|
.ts, .tsx, .js, .json | Biome | biome.json |
.astro, .svelte, .md, .mdx | Prettier | prettier.config.js |
.css | Prettier | prettier.config.js |
.yaml, .yml | Prettier | prettier.config.js |
Formatting Rules
- •Indent: 4 spaces (2 for JSON/YAML/Markdown)
- •Line width: 120 characters
- •Quotes: Single quotes
- •Semicolons: Always
- •Trailing commas: Always