From 581c38cdd05074033b86c1f46eca0cebb08c55ba Mon Sep 17 00:00:00 2001 From: Alexandre Stahmer Date: Wed, 3 Apr 2024 23:08:36 +0200 Subject: [PATCH] fix(prettier-plugin): sort compoundVariants/staticCss last for cva/recipes --- .changeset/wet-fishes-flash.md | 5 +++++ packages/prettier-plugin/src/pretty-panda.ts | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/wet-fishes-flash.md diff --git a/.changeset/wet-fishes-flash.md b/.changeset/wet-fishes-flash.md new file mode 100644 index 000000000..2c9ac6d1f --- /dev/null +++ b/.changeset/wet-fishes-flash.md @@ -0,0 +1,5 @@ +--- +"@pandabox/prettier-plugin": patch +--- + +fix(prettier-plugin): sort compoundVariants/staticCss last for cva/recipes diff --git a/packages/prettier-plugin/src/pretty-panda.ts b/packages/prettier-plugin/src/pretty-panda.ts index 62f2a921e..79d73775c 100644 --- a/packages/prettier-plugin/src/pretty-panda.ts +++ b/packages/prettier-plugin/src/pretty-panda.ts @@ -10,7 +10,16 @@ import type { PluginOptions } from './options' const NodeType = TSESTree.AST_NODE_TYPES const recipeFnNames = ['cva', 'sva', 'defineRecipe', 'defineSlotRecipe'] -const cvaOrder = ['className', 'description', 'slots', 'base', 'variants', 'defaultVariants'] +const cvaOrder = [ + 'className', + 'description', + 'slots', + 'base', + 'variants', + 'defaultVariants', + 'compoundVariants', + 'staticCss', +] const pandaConfigFns = ['defineStyles', 'defineRecipe', 'defineSlotRecipe'] export class PrettyPanda {