sqlfu includes a SQL formatter that started from a vendored copy ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iterate/sqlfu/llms.txt
Use this file to discover all available pages before exploring further.
sql-formatter and then diverged. The current defaults are intentionally opinionated: lowercase keywords, SQLite-first dialect, and a bias toward keeping simple clause bodies inline when they still read well. You can run it from the CLI to rewrite files, wire it into ESLint for editor and CI feedback, or call it programmatically from TypeScript.
CLI
Rewrite.sql files in place by passing file paths, directories, or glob patterns:
ESLint
The lint plugin exposes the same formatter through thesqlfu/format-sql rule. Wire it up in your ESLint flat config:
eslint.config.js
sqlfu/query-naming and sqlfu/generated-query-freshness.
Programmatic
Importformat from sqlfu/api to format a SQL string in TypeScript:
Opinionated defaults
The formatter makes three deliberate choices:- Lowercase — SQL keywords are downcased.
SELECTbecomesselect,WHEREbecomeswhere. - SQLite-first — dialect defaults are tuned for SQLite syntax, not ANSI SQL or PostgreSQL.
- Inline when readable — simple clause bodies stay on one line rather than being broken across multiple lines.
select id, slug from posts where id = 1is left inline; longer or more complex queries are formatted with line breaks.