eslint-plugin-sql-formatter
v1.0.5
Published
ESLint plugin for formatting *.sql files and sql`...` template strings inside *.js files
Downloads
69
Maintainers
Readme
eslint-plugin-sql-formatter
ESLint plugin that allows formatting of sql queries in *.sql files and template literals in .js/.ts files.
Installation
- Install ESLint.
- Install
eslint-plugin-sql-formatter
plugin.
npm install eslint --save-dev
npm install eslint-plugin-sql --save-dev
Configuration
- Add
plugins
section and specifysql-formatter
as a plugin. - Enable rules.
{
"plugins": [
"sql"
],
"rules": {
"sql/format": [
"error",
{
// Everything is optional.
"ignoreSingleLine": true, // Do not format if sql query fits single line. Enabled by default.
"sqlFormatterConfig": {
// https://github.com/sql-formatter-org/sql-formatter#configuration-options
"language": "mysql",
// ... any other option from sql-formatter
}
}
],
}
}