Closed MrSwitch closed 9 months ago
I think you're using the option in a wrong way.
The dialect
in the prettier-plugin-sql
plugin is expecting a stringified JSON-like (will be parserd by JSOX
) object, but you're setting it to a string 'mysql'
. That's why the tokenizer throws this error.
You can discard the dialect
option and simply use the language
option to tell the plugin you're formatting mysql language.
Also, you don't need the embeddedSqlParser
option if you're using the prettier-plugin-sql
plugin to format your embedded sql code. embeddedSqlParser
is only for the prettier-plugin-sql-cst
plugin.
Yep. As @Sec-ant said. Just use the language
option. The main purpose of the dialect
option is defining a custom SQL dialect.
Also be aware that indentStyle: tabularLeft is deprecated and will be removed in future versions of the formatter.
Thankyou both @Sec-ant and @nene for pointing helping me out there.
Describe the bug
Given any SQL in JS, i.e. ...
And using a
.prettierrc.js
like...Expected behavior Expect no bug
Actual behavior But whilst it does format it the item, we also get the error...
Usage
prettier-plugin-sql
andprettier-plugin-embed
they will pick up SQL in JS such as...ps: Many thanks for this project it's awesome!