nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst
https://nene.github.io/prettier-sql-playground/
GNU General Public License v3.0
123 stars 7 forks source link

Export and expose the options interface #17

Closed Sec-ant closed 9 months ago

Sec-ant commented 9 months ago

Would you mind exposing the options interface so this can be used in prettier-plugin-embed? This is also helpful if users are using JSDoc to get type hints when configuring prettier, or using prettier programmatically in a TypeScript project.

https://github.com/nene/prettier-plugin-sql-cst/blob/57f988d5d7365d20214d63d7406bef56d581a985/src/options.ts#L4-L7

And apparently they have default values so the properties should also be optional?

export interface SqlPluginOptions {
  sqlKeywordCase?: "preserve" | "upper" | "lower";
  sqlParamTypes?: NonNullable<CstParserOptions["paramTypes"]>;
}
nene commented 9 months ago

Yeah, why not.

I exposed the SqlPluginOptions interface in 9.0.1 release.

You can wrap it in Partial<> if you need the fields to be optional. I'm internally using the non-optional fields variant because prettier fills in the default values. Not sure how exactly it's going to be used externally. Like one probably wants to combine it with the prettier builtin options interface.