nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst

Home Page:https://nene.github.io/prettier-sql-playground/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export and expose the options interface

Sec-ant opened this issue · comments

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.

export interface SqlPluginOptions {
sqlKeywordCase: "preserve" | "upper" | "lower";
sqlParamTypes: NonNullable<CstParserOptions["paramTypes"]>;
}

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

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

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.