Get the latest version from NPM:
npm install sql-formatter
This will output:
SELECT * FROM table1
You can also pass in configuration options:
Currently just four SQL dialects are supported:
// Named placeholderssqlFormatter);// Indexed placeholderssqlFormatter);
Both result in:
SELECT * FROM tbl WHERE foo = 'bar'
Usage without NPM
If you don't use a module bundler, clone the repository, run
npm install and grab a file from
/dist directory to use inside a
This makes SQL Formatter available as a global variable
# run linter and tests$ npm run check
...and you're ready to poke us with a pull request.