Skip to content

Commit 4f46845

Browse files
committed
Revert to independent defaults
1 parent 9d4c929 commit 4f46845

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

docs/dataTypeCase.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ Note: Casing of function names like `VARCHAR(30)` are not modified - instead rel
88

99
## Options
1010

11-
- `"preserve"` preserves the original case.
11+
- `"preserve"` (default) preserves the original case.
1212
- `"upper"` converts to uppercase.
1313
- `"lower"` converts to lowercase.
1414

15-
The default is either `options.keywordCase` (if you have set it) or `"preserve"`.
16-
1715
### preserve
1816

1917
```sql

docs/functionCase.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ Converts functions to upper- or lowercase.
44

55
## Options
66

7-
- `"preserve"` preserves the original case.
7+
- `"preserve"` (default) preserves the original case.
88
- `"upper"` converts to uppercase.
99
- `"lower"` converts to lowercase.
1010

11-
The default is either `options.keywordCase` (if you have set it) or `"preserve"`.
12-
1311
### preserve
1412

1513
```sql

src/sqlFormatter.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ export type FormatOptionsWithDialect = Partial<FormatOptions> & {
3737
dialect: DialectOptions;
3838
};
3939

40+
const defaultOptions: FormatOptions = {
41+
tabWidth: 2,
42+
useTabs: false,
43+
keywordCase: 'preserve',
44+
identifierCase: 'preserve',
45+
dataTypeCase: 'preserve',
46+
functionCase: 'preserve',
47+
indentStyle: 'standard',
48+
logicalOperatorNewline: 'before',
49+
expressionWidth: 50,
50+
linesBetweenQueries: 1,
51+
denseOperators: false,
52+
newlineBeforeSemicolon: false,
53+
};
54+
4055
/**
4156
* Format whitespace in a query to make it easier to read.
4257
*
@@ -73,21 +88,6 @@ export const formatDialect = (
7388
throw new Error('Invalid query argument. Expected string, instead got ' + typeof query);
7489
}
7590

76-
const defaultOptions: FormatOptions = {
77-
tabWidth: 2,
78-
useTabs: false,
79-
keywordCase: 'preserve',
80-
identifierCase: 'preserve',
81-
dataTypeCase: cfg.keywordCase || 'preserve',
82-
functionCase: cfg.keywordCase || 'preserve',
83-
indentStyle: 'standard',
84-
logicalOperatorNewline: 'before',
85-
expressionWidth: 50,
86-
linesBetweenQueries: 1,
87-
denseOperators: false,
88-
newlineBeforeSemicolon: false,
89-
};
90-
9191
const options = validateConfig({
9292
...defaultOptions,
9393
...cfg,

0 commit comments

Comments
 (0)