Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-sql-cst

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-sql-cst - npm Package Compare versions

Comparing version 0.11.8 to 0.12.0

dist/syntax/unsupported_grammar.d.ts

2

dist/index.js

@@ -47,2 +47,4 @@ "use strict";

paramTypes: options.sqlParamTypes,
acceptUnsupportedGrammar: options
.sqlAcceptUnsupportedGrammar,
}), text, options);

@@ -49,0 +51,0 @@ },

@@ -7,4 +7,5 @@ import { ParserOptions, SupportOptions } from "prettier";

sqlCanonicalSyntax: boolean;
sqlAcceptUnsupportedGrammar: boolean;
}
export type AllPrettierOptions<T = Node> = ParserOptions<T> & SqlPluginOptions;
export declare const options: SupportOptions;

@@ -44,2 +44,9 @@ "use strict";

},
sqlAcceptUnsupportedGrammar: {
type: "boolean",
category: "SQL",
default: false,
description: "Skips formatting unsupported SQL statements instead of exiting with an error",
// Since 0.12.0
},
};

3

dist/syntax/transformMap.js

@@ -48,2 +48,3 @@ "use strict";

var type_1 = require("./type");
var unsupported_grammar_1 = require("./unsupported_grammar");
var update_1 = require("./update");

@@ -55,2 +56,2 @@ var view_1 = require("./view");

var postgresql_1 = require("./dialects/postgresql");
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_action_1.alterActionMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), domain_1.domainMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), rename_table_1.renameTableMap), schema_1.schemaMap), select_1.selectMap), sequence_1.sequenceMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), type_1.typeMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap);
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_action_1.alterActionMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), domain_1.domainMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), rename_table_1.renameTableMap), schema_1.schemaMap), select_1.selectMap), sequence_1.sequenceMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), type_1.typeMap), unsupported_grammar_1.unsupportedGrammarMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap);
{
"name": "prettier-plugin-sql-cst",
"version": "0.11.8",
"version": "0.12.0",
"description": "Prettier plugin for SQL",

@@ -39,6 +39,7 @@ "contributors": [

"prettier": "^3.0.3",
"sql-parser-cst": "^0.29.1"
"sql-parser-cst": "^0.30.0"
},
"devDependencies": {
"@types/jest": "^29.2.5",
"@types/node": "^22.9.0",
"chalk": "^4.1.2",

@@ -45,0 +46,0 @@ "dedent-js": "^1.0.1",

@@ -122,7 +122,8 @@ # Prettier plugin SQL-CST [![npm version](https://img.shields.io/npm/v/prettier-plugin-sql-cst)](https://www.npmjs.com/package/prettier-plugin-sql-cst) ![build status](https://github.com/nene/prettier-plugin-sql-cst/actions/workflows/build.yml/badge.svg)

| API Option | Default | Description |
| -------------------- | :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sqlKeywordCase` | `upper` | Converts SQL keywords to `upper` or `lower` case, or `preserve` existing. Note that for now `preserve` is somewhat incompatible with `sqlCanonicalSyntax: true` (e.g. the added `AS` keywords will always be in uppercase). |
| `sqlParamTypes` | `[]` | Array of bound parameter types: `?`, `?nr`, `$nr`, `:name`, `@name`, `$name`. |
| `sqlCanonicalSyntax` | `true` | When enabled, performs some opinionated changes of keywords and operators, like enforcing the use of `AS` in aliases and replacing `<>` comparisons with `!=`. See [STYLE_GUIDE][] for more details. (Since 0.11.0) |
| API Option | Default | Description |
| ----------------------------- | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sqlKeywordCase` | `upper` | Converts SQL keywords to `upper` or `lower` case, or `preserve` existing. Note that for now `preserve` is somewhat incompatible with `sqlCanonicalSyntax: true` (e.g. the added `AS` keywords will always be in uppercase). |
| `sqlParamTypes` | `[]` | Array of bound parameter types: `?`, `?nr`, `$nr`, `:name`, `@name`, `$name`. |
| `sqlCanonicalSyntax` | `true` | When enabled, performs some opinionated changes of keywords and operators, like enforcing the use of `AS` in aliases and replacing `<>` comparisons with `!=`. See [STYLE_GUIDE][] for more details. (Since 0.11.0) |
| `sqlAcceptUnsupportedGrammar` | `false` | Normally when the plugin encounters SQL syntax it doesn't support it will throw an error and won't format anything at all. With this option enabled, it will skip over SQL statements it doesn't recognize, leaving them as-is. |

@@ -177,4 +178,6 @@ ## Usage inside VSCode

Mainly one can expect the formatting of SELECT, INSERT, UPDATE, DELETE statements to work.
But beyond that you should keep your expectations low. You have been warned.
To overcome this limitation you can enable the `sqlAcceptUnsupportedGrammar` option,
which will make the plugin skip the SQL statements it doesn't recognize.
The specifics of the [SQL formatting style][STYLE_GUIDE] are still very much subject to change.

@@ -181,0 +184,0 @@ Though the general principles should be mostly in place by now.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc