Automatically format Leo source files according to the official Leo style guide. This command ensures consistent code formatting across your project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/provablehq/leo/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Options
Check if files are formatted without making changes. Exit with code 1 if any files need formatting.
Specific file or directory to format. Defaults to current directory.
Examples
Format all files in project
Check formatting without changes
Format specific file
Format specific directory
Formatting Rules
Leo follows these formatting conventions:Indentation
- Use 4 spaces for indentation
- No tabs
Line Length
- Maximum 120 characters per line
- Break long lines at logical points
Spacing
Function Declarations
Imports
Integration
Pre-commit Hook
Add to.git/hooks/pre-commit:
VS Code
Configure VS Code to format on save by adding to.vscode/settings.json:
CI/CD Integration
Add formatting check to your CI pipeline:Related Commands
Best Practices
The formatter preserves comments and applies minimal changes to maintain code readability.
Troubleshooting
Format check fails in CI
Ifleo fmt --check fails in CI, run locally: