prettier-sql
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -381,3 +381,8 @@ "use strict"; | ||
} else if (token.type === _token.TokenType.RESERVED_KEYWORD) { | ||
if (!(_token.isToken.AS(token) && _this3.cfg.aliasAs === _types.AliasMode.never)) { | ||
var _this3$tokenLookBehin, _this3$tokenLookAhead; | ||
if (!(_token.isToken.AS(token) && (_this3.cfg.aliasAs === _types.AliasMode.never || // skip all AS if never | ||
_this3.cfg.aliasAs === _types.AliasMode.select && ((_this3$tokenLookBehin = _this3.tokenLookBehind()) === null || _this3$tokenLookBehin === void 0 ? void 0 : _this3$tokenLookBehin.value) === ')' && // ) [AS] alias but not SELECT (a) [AS] alpha | ||
!_this3.withinSelect && // skip WITH foo [AS] ( ... | ||
((_this3$tokenLookAhead = _this3.tokenLookAhead()) === null || _this3$tokenLookAhead === void 0 ? void 0 : _this3$tokenLookAhead.value) !== '('))) { | ||
// do not format if skipping AS | ||
@@ -485,2 +490,4 @@ formattedQuery = _this3.formatWithSpaces(token, formattedQuery); | ||
value: function formatOperator(token, query) { | ||
var _this$tokenLookBehind; | ||
// special operator | ||
@@ -500,3 +507,4 @@ if (token.value === ',') { | ||
if (this.cfg.denseOperators) { | ||
if (this.cfg.denseOperators && ((_this$tokenLookBehind = this.tokenLookBehind()) === null || _this$tokenLookBehind === void 0 ? void 0 : _this$tokenLookBehind.type) !== _token.TokenType.RESERVED_COMMAND) { | ||
// do not trim whitespace if SELECT * | ||
return this.formatWithoutSpaces(token, query); | ||
@@ -542,3 +550,3 @@ } | ||
} else { | ||
var _token$whitespaceBefo, _this$tokenLookBehind; | ||
var _token$whitespaceBefo, _this$tokenLookBehind2; | ||
@@ -549,3 +557,3 @@ // Take out the preceding space unless there was whitespace there in the original query | ||
if (((_token$whitespaceBefo = token.whitespaceBefore) === null || _token$whitespaceBefo === void 0 ? void 0 : _token$whitespaceBefo.length) === 0 && !preserveWhitespaceFor.includes((_this$tokenLookBehind = this.tokenLookBehind()) === null || _this$tokenLookBehind === void 0 ? void 0 : _this$tokenLookBehind.type)) { | ||
if (((_token$whitespaceBefo = token.whitespaceBefore) === null || _token$whitespaceBefo === void 0 ? void 0 : _token$whitespaceBefo.length) === 0 && !preserveWhitespaceFor.includes((_this$tokenLookBehind2 = this.tokenLookBehind()) === null || _this$tokenLookBehind2 === void 0 ? void 0 : _this$tokenLookBehind2.type)) { | ||
query = (0, _utils.trimSpacesEnd)(query); | ||
@@ -552,0 +560,0 @@ } else if (!this.cfg.parenOptions.openParenNewline) { |
{ | ||
"name": "prettier-sql", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Format whitespace in a SQL query to make it more readable", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
<img src="static/prettier-sql-clean.svg" width="128"/> | ||
# Prettier SQL [![NPM version](https://img.shields.io/npm/v/prettier-sql.svg)](https://npmjs.com/package/prettier-sql) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/inferrinizzard/prettier-sql/coveralls/develop?label=Dev%20Build&logo=Github) ![GitHub Workflow Status (event)](https://img.shields.io/github/workflow/status/inferrinizzard/prettier-sql/webpack/master?event=push&label=Prod%20Build&logo=Github) ![Coveralls](https://img.shields.io/coveralls/github/inferrinizzard/prettier-sql?branch=master&label=Coverage&logo=coveralls&style=plastic) | ||
# Prettier SQL [![NPM version](https://img.shields.io/npm/v/prettier-sql.svg)](https://npmjs.com/package/prettier-sql) ![GitHub Workflow Status (event)](https://img.shields.io/github/workflow/status/inferrinizzard/prettier-sql/coveralls/master?label=Build&logo=Github) ![Coveralls](https://img.shields.io/coveralls/github/inferrinizzard/prettier-sql?branch=master&label=Coverage&logo=coveralls&style=plastic) | ||
@@ -27,3 +27,3 @@ ## **Prettier SQL** is a JavaScript library for pretty-printing SQL queries. | ||
→ [Try the demo.](https://inferrinizzard.github.io/prettier-sql/) | ||
→ [Try the demo.](https://inferrinizzard.github.io/prettier-sql/static) | ||
@@ -30,0 +30,0 @@ # Table of contents |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2006928
7746