SQL Formatter is a JavaScript library for pretty-printing SQL queries. It supports many dialects: Standard SQL, MariaDB, MySQL, PostgreSQL, DB2, PL/SQL (Oracle), N1QL (Couchbase), Redshift (Amazon), Spark, and T-SQL. Version 4.0.11 is the latest stable release. It is actively maintained, with releases on npm. Key differentiators: broad dialect support, placeholders replacement, and a CLI tool. The library ships TypeScript types and is ESM-first. It does not support stored procedures or custom delimiters.
npm install cl-sql-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats a SQL query with PostgreSQL dialect, 4-space indent, uppercase keywords, placeholders replacement, and double line spacing.
Add `uppercase: true` to options object.
Use dynamic import: const { format } = await import('sql-formatter').Import as named: import { format } from 'sql-formatter'.Always pass params if you expect placeholder replacement.
Ensure input SQL is syntactically correct before formatting.
Use import or dynamic import: const { format } = await import('sql-formatter')Correct import: import { format } from 'sql-formatter'Run npm install sql-formatter
No dependency data recorded yet.