Closed musjj closed 1 month ago
Describe the bug
The .sql-formatter.json in the current directory is ignored, unless specified with --config:
.sql-formatter.json
--config
$ cat .sql-formatter.json { "language": "postgresql" } $ echo "SELECT 2 :: numeric AS foo;" | sql-formatter Error: Parse error: Unexpected ":: numeric" at line 1 column 10. This likely happens because you're using the default "sql" dialect. If possible, please select a more specific dialect (like sqlite, postgresql, etc). $ echo "SELECT 2 :: numeric AS foo;" | sql-formatter --config .sql-formatter.json SELECT 2::numeric AS foo;
I suspect that this is caused by this:
https://github.com/sql-formatter-org/sql-formatter/blob/2c495334f1ea78e07fea0ddd6b2ddbe9dd9f5583/bin/sql-formatter-cli.cjs#L102
Which means it defaults to searching in the installed directory instead of the current directory.
Expected behavior .sql-formatter.json should be automatically read
Actual behavior .sql-formatter.json is not automatically read
Usage
echo "SELECT 2 :: numeric AS foo;" | sql-formatter
15.4.2
Fixed in 15.4.4
Describe the bug
The
.sql-formatter.json
in the current directory is ignored, unless specified with--config
:I suspect that this is caused by this:
https://github.com/sql-formatter-org/sql-formatter/blob/2c495334f1ea78e07fea0ddd6b2ddbe9dd9f5583/bin/sql-formatter-cli.cjs#L102
Which means it defaults to searching in the installed directory instead of the current directory.
Expected behavior
.sql-formatter.json
should be automatically readActual behavior
.sql-formatter.json
is not automatically readUsage
echo "SELECT 2 :: numeric AS foo;" | sql-formatter
15.4.2