diff --git a/src/prettier/factory.ts b/src/prettier/factory.ts index e6f2a6fe..2c90aa11 100644 --- a/src/prettier/factory.ts +++ b/src/prettier/factory.ts @@ -5,10 +5,15 @@ export function prettier( options: Options = {}, userConfig: Config = {}, ): Config { - const { jsdoc } = parseOptions(options); + const { curly, jsdoc } = parseOptions(options); const plugins = []; - if (jsdoc) plugins.push("prettier-plugin-jsdoc"); + if (jsdoc) { + plugins.push("prettier-plugin-jsdoc"); + } + if (curly) { + plugins.push("prettier-plugin-curly"); + } return { plugins, diff --git a/src/prettier/types.ts b/src/prettier/types.ts index c5113f69..12ce1977 100644 --- a/src/prettier/types.ts +++ b/src/prettier/types.ts @@ -4,6 +4,13 @@ import type { Config as PrettierConfig } from "prettier"; export type Config = PrettierConfig & Record; export interface Options { + /** + * Format curly braces. + * + * @default true + */ + curly?: boolean; + /** * Format JSDoc and TSDoc comments. Use prettier-plugin-jsdoc. * diff --git a/src/prettier/utils.ts b/src/prettier/utils.ts index 4b969428..b9a92d62 100644 --- a/src/prettier/utils.ts +++ b/src/prettier/utils.ts @@ -2,6 +2,7 @@ import type { Options } from "./types.ts"; export function parseOptions(options: Options = {}): Required { return { + curly: options.curly ?? true, jsdoc: options.jsdoc ?? true, }; }