-
Notifications
You must be signed in to change notification settings - Fork 0
/
prettier.config.js
35 lines (31 loc) · 1.07 KB
/
prettier.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/** @type {import('prettier').Config} */
const prettierConfig = {
plugins: ['prettier-plugin-embed', 'prettier-plugin-sql'],
singleQuote: true,
trailingComma: 'all',
};
/** @type {import('prettier-plugin-embed').PrettierPluginEmbedOptions} */
const prettierPluginEmbedConfig = {
embeddedSqlComments: ['sql'],
embeddedSqlTags: ['sql'],
};
/** @type {import('prettier-plugin-sql').SqlBaseOptions} */
const prettierPluginSqlConfig = {
language: 'postgresql',
keywordCase: 'upper',
identifierCase: 'lower',
dataTypeCase: 'lower',
functionCase: 'lower',
// - Wrap all parenthesized expressions to new lines (eg. `INSERT` columns)
// - Do not wrap foreign keys (eg. `REFERENCES table_name (id)`)
// - Do not wrap column type expressions (eg. `VARCHAR(255)`)
// - Do not wrap longer field names when used alone (eg. `address_line_one`)
// - Do not wrap shorter expressions in function calls (eg. `avg(ratings.rating)`)
expressionWidth: 30,
};
const config = {
...prettierConfig,
...prettierPluginEmbedConfig,
...prettierPluginSqlConfig,
};
export default config;