Releases: sql-formatter-org/sql-formatter
Releases · sql-formatter-org/sql-formatter
prettier-sql v5.1.0
(Released under name prettier-sql)
Known Issues
newline: numberdoes not work with[foo],[and]both count as 1 token each so[foo]would be 3 itemsarray[0]ormap[key]do still work as they are parsed as WORD
- BigQuery formatter fails a few tests (ALTER TABLE, tricky line comments) due to those tests not including valid BigQuery SQL, those tests are currently skipped
Added
Source:
- consumed VSCode Extension as subrepo
- added support for Hive language
- added support for BigQuery language
- added keyword dedupe on Formatter classes via Set
VSCode:
- added command
prettier-sql-vscode.format-selection- Formats SQL selections
- added settings to override user/workspace
tabSizeandinsertSpacessettings - added error message on format fail
- added setting to override formatting language for
sqlfiles when SQL flavour does not have a VSCode language ID (Microsoft PostgreSQL and MSSQL Extensions)
Other:
- demo page now deployed as git repo subtree, served from root/ (subtree of static/)
Updated
- fixed handling of
newlineoptions - simplified
NewlineModeconfig - fixed ; indentation when used with
semicolonNewlineandtenSpaceconfigs - Formatter now uses numeric for loop to allow for index manipulation
- updated
linesBetweenQueriesto add an extra newline (0 lines = 1 line break, no space in between) - renamed Formatter class files to
<flavour>.formatter.ts - renamed test files to
<flavour>.test.js
Removed
- removed
newline: hybridconfignewline: numbernow acts likehybrid
prettier-sql v5.0.1
(Released under name prettier-sql)
Updated
- fixed bug when using SELECT * and
denseOperators - fixed aliasAs option on demo page
- fixed handling of tokens with
aliasAsflag - demo page now prints stack trace in textarea on error
prettier-sql v5.0.0
(Released under name prettier-sql)
Added
Source:
- added support for ES6 module exports with TypeScript
- updated webpack with ts-loader for module types
- added tsc to babel commonjs build command
- added index.ts pass-through export
Other:
- added GH Actions for CI build
- added issue templates
Updated
Source:
- updated demo page for all new options
Other:
- renamed library to
prettier-sql
Fixed
- fixed bugs related to operator tokens
Removed
- removed Travis CI (replaced by GH Actions)
prettier-sql v5.0.0-beta.1
(Released under name prettier-sql)
prettier-sql v5.0.0-beta
(Released under name prettier-sql)
Added
Source:
- added option
aliasAsto toggle use of AS in column, table, query aliases- modes: always (SELECT and table), select (SELECT only), never
- added option
newlineto specify rules for inserting newlines within SQL Statements- modes:
always (break before all arguments)
lineWidth (break after line exceeds lineWidth)
itemCount (break after n items)
hybrid (lineWidth OR itemCount)
never (place all Statements on one line)
- modes:
- added flag
denseOperatorsto toggle spaces around binary operators (=, +, %, etc.) - added flag
semicolonNewlineto toggle placing semicolon on newline vs same line - added flag
tabulateAliasfor alias tabular mode, aligned on longest line, not including AS - added option
commaPositionto specify comma placement within listed Statements- modes:
before(comma goes before column),
after(standard),
tabular(aligned to longest line)
- modes:
- added option
keywordPositionto support vertically aligned keywords- modes:
standard,
tenSpaceLeft(left-aligned within keyword column),
tenSpaceRight(right-aligned within keyword column)
- modes:
- added flag
breakBeforeBooleanOperatorto toggle breaking before or after logical operators like AND and OR - added options
parenOptionsfor misc rules regarding parenthesis positionopenParenNewline- flag for opening paren on newline or same linecloseParenNewline- flag for closing paren on newline or same line
Other:
- added enums for all typed config options
Files Added:
- test/comma.js (tests for comma position)
- test/alias.js (tests for alias AS and alias position)
- test/keywordPosition.js (tests for keyword position modes)
- test/newline.js (tests for newline modes)
- test/parenthesis.js (tests for paren positions)
Updated
Source:
- converted repo to Typescript
- overhauled Keyword lists for all languages
- added default options for all configs
- updated CLI to use config file
- renamed Keyword categories to semantic Keyword types
- reservedTopLevelWord → reservedCommand
- reservedTopLevelWordNoIndent → reservedBinaryCommand
- reservedNewline → reservedDependentClause & reservedLogicalOperator
- reservedWord → reservedKeyword
- added reservedFunctions
- updated Tokenizer class and token.ts to be more DRY
Removed
- tokenTypes.ts (token types moved to TokenType enum in token.ts)
- sqlFormatter.d.ts (converted to TypeScript)
v4.0.2
v4.0.1
v4.0.0
Breaking changes:
- Standard SQL formatter (
"sql") now only supports standard SQL. This means:- single-quotes for strings and double-quotes for identifiers and no other quote types;
- only
?placeholders for parameters; - only standard SQL operators;
- only standard SQL sql
--and/* */comments, - if you used
language: "sql"before, you're likely better off switching tolanguage: "postgresql" | "mariadb" | "mysql" | "tsql".
- Dropped
-f/--fileoption from CLI. Instead a positional file argument can be used, like with any normal UNIX tool). - Default export no more exists. Only named export of format function (and supportedDialects - used by CLI).
- Removed FORMATTERS export.
"pl/sql"alias has been removed. Use"plsql"instead.
New dialects:
- PostgreSQL support
- MariaDB support
- MySQL support
- Transact-SQL support
Fixes:
- Proper formatting of BETWEEN _ AND _
- Bunch of additional operators supported
- No more mixing UNIX and Windows line endings - output is always converted to UNIX LF line endings.
Internal:
- Better whitespace handling without having a separate whitespace token.
- Upgrade to argparse 2.0
- Lots of refactoring and reorganization of tests.
v4.0.0-beta.0
4.0.0-beta.0