{"id":41996,"library":"sql-formatter-plus","title":"SQL Formatter Plus","description":"SQL Formatter Plus is a fork of SQL Formatter that adds bug fixes and features like keyword uppercasing and configurable line breaks between queries. Current stable version is 1.3.6. It formats SQL queries with support for Standard SQL, Couchbase N1QL, IBM DB2, and Oracle PL/SQL dialects. Differentiating features include placeholder replacement, configurable indentation, and ESM module support. It is released on npm and compatible with Node.js and browsers.","status":"active","version":"1.3.6","language":"javascript","source_language":"en","source_url":"https://github.com/kufii/sql-formatter-plus","tags":["javascript","sql","formatter","format","n1ql","whitespace"],"install":[{"cmd":"npm install sql-formatter-plus","lang":"bash","label":"npm"},{"cmd":"yarn add sql-formatter-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add sql-formatter-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import is the standard way to use the library in ESM environments.","symbol":"sqlFormatter","correct":"import sqlFormatter from 'sql-formatter-plus'"},{"note":"CommonJS require works for Node.js usage.","symbol":"sqlFormatter","correct":"const sqlFormatter = require('sql-formatter-plus')"}],"quickstart":{"code":"import sqlFormatter from 'sql-formatter-plus';\n\nconst query = 'SELECT * FROM users WHERE id = ?';\nconst formatted = sqlFormatter.format(query, {\n  language: 'sql',\n  indent: '  ',\n  uppercase: false,\n  linesBetweenQueries: 1,\n  params: [1]\n});\nconsole.log(formatted);\n// Output:\n// SELECT\n//   *\n// FROM\n//   users\n// WHERE\n//   id = 1","lang":"javascript","description":"Demonstrates basic formatting of a SELECT query with parameter replacement."},"warnings":[{"fix":"Always use the actual package name 'sql-formatter-plus' for importing.","message":"The package name is 'sql-formatter-plus', but the import path in the README shows 'sql-formatter' in one place. Ensure you use 'sql-formatter-plus' for imports.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check documentation for available options; these features are specific to this fork.","message":"Options like 'uppercase' and 'linesBetweenQueries' are specific to this fork and may not be present in the original sql-formatter.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass parameters as properly quoted strings: params: {foo: \"'bar'\"} or params: [\"'bar'\"].","message":"Parameter replacement with 'params' expects values to be strings with quotes included. For example, use \"'bar'\" instead of 'bar'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your SQL dialect is among the supported ones, otherwise formatting may be incorrect.","message":"This library only supports four SQL dialects: sql, n1ql, db2, pl/sql. Other dialects may not format correctly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.3.6':32 'add':14 'break':25 'browser':71 'bug':15 'compat':67 'configur':23,55 'couchbas':42 'current':28 'db2':45 'dialect':49 'differenti':50 'esm':58 'featur':18,51 'fix':16 'fork':9 'format':34,75 'formatt':2,5,12,74 'ibm':44 'includ':52 'indent':56 'javascript':72 'keyword':20 'like':19 'line':24 'modul':59 'n1ql':43,76 'node.js':69 'npm':65 'oracl':47 'pl/sql':48 'placehold':53 'plus':3,6 'queri':27,36 'releas':63 'replac':54 'sql':1,4,11,35,41,73 'stabl':29 'standard':40 'support':38,60 'uppercas':21 'version':30 'whitespac':77","created_at":"2026-06-04T18:55:06.921758+00:00","updated_at":"2026-06-04T18:55:06.921758+00:00","problems":[{"fix":"Use default import: import sqlFormatter from 'sql-formatter-plus'","cause":"Importing the module incorrectly (e.g., using named import instead of default).","error":"TypeError: sqlFormatter.format is not a function"},{"fix":"Use one of: 'sql', 'n1ql', 'db2', 'pl/sql'","cause":"Specifying an unsupported dialect.","error":"Error: Unknown language: 'postgresql'"},{"fix":"Check the SQL syntax; the formatter expects valid SQL.","cause":"Unmatched parentheses or syntax errors in the query.","error":"Unexpected token: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/kufii/sql-formatter-plus#readme","github":"https://github.com/kufii/sql-formatter-plus","docs":null,"changelog":null,"pypi":null,"npm":"sql-formatter-plus","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}