shadcn-ember 0.0.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,29 @@ npx shadcn-ember add
38
38
 
39
39
  Visit http://shadcn-ember.com to view the documentation.
40
40
 
41
+ ## ESLint Plugin
42
+
43
+ This package includes an ESLint plugin with rules specific to shadcn-ember components.
44
+
45
+ ### Setup
46
+
47
+ Make sure you have `ember-eslint-parser` installed, then add the recommended config to your `eslint.config.mjs`:
48
+
49
+ ```js
50
+ import shadcnEmber from 'shadcn-ember/eslint';
51
+
52
+ export default [
53
+ ...shadcnEmber.configs.recommended,
54
+ // your other config...
55
+ ];
56
+ ```
57
+
58
+ ### Rules
59
+
60
+ | Rule | Description | Fixable |
61
+ | --- | --- | --- |
62
+ | [require-class-arg](docs/rules/require-class-arg.md) | Require `@class` instead of `class` on component invocations | 🔧 |
63
+
41
64
  ## Aknowledgements
42
65
 
43
66
  This is a fork of `shadcn-vue` CLI, adapted for Ember.
@@ -1,4 +1,4 @@
1
- import { h as registryItemSchema, r as configSchema, u as registryIndexSchema } from "./index-DxzyGeF-.js";
1
+ import { h as registryItemSchema, r as configSchema, u as registryIndexSchema } from "./index-QSYTZ_w1.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/utils/get-config.d.ts
@@ -24,13 +24,13 @@ declare function getRegistry(name: string, options?: {
24
24
  devDependencies?: string[] | undefined;
25
25
  registryDependencies?: string[] | undefined;
26
26
  files?: ({
27
- type: "registry:page" | "registry:file";
28
27
  path: string;
28
+ type: "registry:page" | "registry:file";
29
29
  target: string;
30
30
  content?: string | undefined;
31
31
  } | {
32
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
33
32
  path: string;
33
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
34
34
  content?: string | undefined;
35
35
  target?: string | undefined;
36
36
  })[] | undefined;
@@ -68,13 +68,13 @@ declare function getRegistryItems(items: string[], options?: {
68
68
  devDependencies?: string[] | undefined;
69
69
  registryDependencies?: string[] | undefined;
70
70
  files?: ({
71
- type: "registry:page" | "registry:file";
72
71
  path: string;
72
+ type: "registry:page" | "registry:file";
73
73
  target: string;
74
74
  content?: string | undefined;
75
75
  } | {
76
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
77
76
  path: string;
77
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
78
78
  content?: string | undefined;
79
79
  target?: string | undefined;
80
80
  })[] | undefined;
@@ -103,13 +103,13 @@ declare function resolveRegistryItems(items: string[], options?: {
103
103
  dependencies?: string[] | undefined;
104
104
  devDependencies?: string[] | undefined;
105
105
  files?: ({
106
- type: "registry:page" | "registry:file";
107
106
  path: string;
107
+ type: "registry:page" | "registry:file";
108
108
  target: string;
109
109
  content?: string | undefined;
110
110
  } | {
111
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
112
111
  path: string;
112
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
113
113
  content?: string | undefined;
114
114
  target?: string | undefined;
115
115
  })[] | undefined;
@@ -148,13 +148,13 @@ declare function getShadcnRegistryIndex(): Promise<{
148
148
  devDependencies?: string[] | undefined;
149
149
  registryDependencies?: string[] | undefined;
150
150
  files?: ({
151
- type: "registry:page" | "registry:file";
152
151
  path: string;
152
+ type: "registry:page" | "registry:file";
153
153
  target: string;
154
154
  content?: string | undefined;
155
155
  } | {
156
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
157
156
  path: string;
157
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
158
158
  content?: string | undefined;
159
159
  target?: string | undefined;
160
160
  })[] | undefined;
@@ -230,13 +230,13 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
230
230
  devDependencies?: string[] | undefined;
231
231
  registryDependencies?: string[] | undefined;
232
232
  files?: ({
233
- type: "registry:page" | "registry:file";
234
233
  path: string;
234
+ type: "registry:page" | "registry:file";
235
235
  target: string;
236
236
  content?: string | undefined;
237
237
  } | {
238
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
239
238
  path: string;
239
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
240
240
  content?: string | undefined;
241
241
  target?: string | undefined;
242
242
  })[] | undefined;
@@ -273,13 +273,13 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
273
273
  devDependencies?: string[] | undefined;
274
274
  registryDependencies?: string[] | undefined;
275
275
  files?: ({
276
- type: "registry:page" | "registry:file";
277
276
  path: string;
277
+ type: "registry:page" | "registry:file";
278
278
  target: string;
279
279
  content?: string | undefined;
280
280
  } | {
281
- type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
282
281
  path: string;
282
+ type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:composable" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
283
283
  content?: string | undefined;
284
284
  target?: string | undefined;
285
285
  })[] | undefined;
@@ -310,4 +310,4 @@ declare function getRegistriesIndex(options?: {
310
310
  }): Promise<Record<string, string>>;
311
311
  //#endregion
312
312
  export { getRegistry as a, getRegistryIcons as c, getShadcnRegistryIndex as d, resolveRegistryItems as f, getRegistriesIndex as i, getRegistryItems as l, Config as m, getItemTargetPath as n, getRegistryBaseColor as o, resolveTree as p, getRegistriesConfig as r, getRegistryBaseColors as s, fetchTree as t, getRegistryStyles as u };
313
- //# sourceMappingURL=api-BAwrG8sa.d.ts.map
313
+ //# sourceMappingURL=api-CC2FX1Xv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-BAwrG8sa.d.ts","names":[],"sources":["../src/utils/get-config.ts","../src/registry/api.ts"],"sourcesContent":[],"mappings":";;;;;AC4CqB,KDrBT,MAAA,GAAS,CAAA,CAAE,KCqBF,CAAA,ODrBe,YCqBf,CAAA;;;iBAHC,WAAA;EDlBV,MAAA,CAAA,ECqBC,ODrBK,CCqBG,MDrBe,CAAA;;ICuBjC;;EALmB,QAAA,EAAA,MAAW;EAGZ,KAAA,EAAA;IAAR,IAAA,EAAA,MAAA;;;;;;;;;;IAEV,KAAA,CAAA,EAAA,CAAA;MAAA,IAAA,EAAA,eAAA,GAAA,eAAA;MAgDmB,IAAA,EAAA,MAAgB;MAGjB,MAAA,EAAA,MAAA;MAAR,OAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;;;;;;;QAEV,OAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;QAAA,OAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;MASmB,CAAA,GAAA,SAAA;IAGD,CAAA,GAAA,SAAA;IAAR,OAAA,CAAA,EAAA;;;;;;;;;IAEV,UAAA,CAAA,EAAA,MAAA,EAAA,GAAA,SAAA;EAAA,CAAA,EAAA;AAQH,CAAA,CAAA;iB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,CAAiC,GAAA,SAAA;;;;;;iBA/JnD,mBAAA,eACT;;;;;;;iBAgCS,sBAAA,CAAA,GAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYtB,iBAAA,CAAA,GAAiB;;;;iBAajB,gBAAA,CAAA,GAAgB,QAAA,eAAA;iBAWhB,qBAAA,CAAA,GAAqB;;;;;;;;;;;;;;;;iBAIrB,oBAAA,qBAAsC;;;;;;;;;;;;;;;;;;;;;iBActC,WAAA,QACb,CAAA,CAAE,aAAa,wCACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BK,SAAA,sBAEd,CAAA,CAAE,aAAa,uBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBrB,iBAAA,SACZ,cACF,KAAK,CAAA,CAAE,aAAa,kDACT;iBAqBG,kBAAA;;IAAmD,QAAA"}
@@ -0,0 +1,27 @@
1
+ import * as eslint0 from "eslint";
2
+ import { ESLint, Linter } from "eslint";
3
+
4
+ //#region src/eslint/index.d.ts
5
+ declare const rules: {
6
+ 'require-class-arg': eslint0.Rule.RuleModule;
7
+ };
8
+ declare const plugin: ESLint.Plugin;
9
+ /**
10
+ * Flat config for enabling all shadcn-ember recommended rules.
11
+ * Requires `ember-eslint-parser` to be installed.
12
+ *
13
+ * @example
14
+ * ```js
15
+ * // eslint.config.mjs
16
+ * import shadcnEmber from 'shadcn-ember/eslint';
17
+ *
18
+ * export default [
19
+ * ...shadcnEmber.configs.recommended,
20
+ * // your other config...
21
+ * ];
22
+ * ```
23
+ */
24
+ declare const configs: Record<string, Linter.Config[]>;
25
+ //#endregion
26
+ export { configs, plugin as default, rules };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/eslint/index.ts"],"sourcesContent":[],"mappings":";;;;cAIM;uBAEL,OAAA,CAAA,IAAA,CAAA;;AAN2C,cAQtC,MAFL,EAEa,MAAA,CAAO,MAFpB;;AAIA;;;;;;;;;;;;;;cAiBK,SAAS,eAAe,MAAA,CAAO"}
@@ -0,0 +1,291 @@
1
+ //#region src/eslint/rules/require-class-arg.ts
2
+ const ERROR_MESSAGE = "Pass `@class` instead of `class` to component `{{componentName}}`. Using `class` passes it as a splattribute and bypasses class merging via `cn()`/`cva()`.";
3
+ /**
4
+ * Known shadcn-ember component names that accept `@class`.
5
+ */
6
+ const SHADCN_COMPONENTS = new Set([
7
+ "Accordion",
8
+ "AccordionItem",
9
+ "AccordionTrigger",
10
+ "AccordionContent",
11
+ "AlertDialog",
12
+ "AlertDialogTrigger",
13
+ "AlertDialogPortal",
14
+ "AlertDialogOverlay",
15
+ "AlertDialogContent",
16
+ "AlertDialogHeader",
17
+ "AlertDialogFooter",
18
+ "AlertDialogTitle",
19
+ "AlertDialogDescription",
20
+ "AlertDialogAction",
21
+ "AlertDialogCancel",
22
+ "Alert",
23
+ "AlertTitle",
24
+ "AlertDescription",
25
+ "AspectRatio",
26
+ "Avatar",
27
+ "AvatarImage",
28
+ "AvatarFallback",
29
+ "Badge",
30
+ "Breadcrumb",
31
+ "BreadcrumbList",
32
+ "BreadcrumbItem",
33
+ "BreadcrumbLink",
34
+ "BreadcrumbPage",
35
+ "BreadcrumbSeparator",
36
+ "BreadcrumbEllipsis",
37
+ "ButtonGroup",
38
+ "ButtonGroupText",
39
+ "ButtonGroupSeparator",
40
+ "Button",
41
+ "Card",
42
+ "CardHeader",
43
+ "CardTitle",
44
+ "CardDescription",
45
+ "CardAction",
46
+ "CardContent",
47
+ "CardFooter",
48
+ "Checkbox",
49
+ "Collapsible",
50
+ "CollapsibleTrigger",
51
+ "CollapsibleContent",
52
+ "Command",
53
+ "CommandDialog",
54
+ "CommandInput",
55
+ "CommandList",
56
+ "CommandEmpty",
57
+ "CommandGroup",
58
+ "CommandItem",
59
+ "CommandShortcut",
60
+ "CommandSeparator",
61
+ "ContextMenu",
62
+ "ContextMenuTrigger",
63
+ "ContextMenuGroup",
64
+ "ContextMenuPortal",
65
+ "ContextMenuSub",
66
+ "ContextMenuRadioGroup",
67
+ "ContextMenuSubTrigger",
68
+ "ContextMenuSubContent",
69
+ "ContextMenuContent",
70
+ "ContextMenuItem",
71
+ "ContextMenuCheckboxItem",
72
+ "ContextMenuRadioItem",
73
+ "ContextMenuLabel",
74
+ "ContextMenuSeparator",
75
+ "ContextMenuShortcut",
76
+ "Dialog",
77
+ "DialogTrigger",
78
+ "DialogPortal",
79
+ "DialogOverlay",
80
+ "DialogContent",
81
+ "DialogHeader",
82
+ "DialogFooter",
83
+ "DialogTitle",
84
+ "DialogDescription",
85
+ "DialogClose",
86
+ "DropdownMenu",
87
+ "DropdownMenuTrigger",
88
+ "DropdownMenuGroup",
89
+ "DropdownMenuPortal",
90
+ "DropdownMenuSub",
91
+ "DropdownMenuRadioGroup",
92
+ "DropdownMenuSubTrigger",
93
+ "DropdownMenuSubContent",
94
+ "DropdownMenuContent",
95
+ "DropdownMenuItem",
96
+ "DropdownMenuCheckboxItem",
97
+ "DropdownMenuRadioItem",
98
+ "DropdownMenuLabel",
99
+ "DropdownMenuSeparator",
100
+ "DropdownMenuShortcut",
101
+ "Empty",
102
+ "EmptyHeader",
103
+ "EmptyMedia",
104
+ "EmptyTitle",
105
+ "EmptyDescription",
106
+ "EmptyContent",
107
+ "FieldSet",
108
+ "FieldLegend",
109
+ "Field",
110
+ "FieldGroup",
111
+ "FieldContent",
112
+ "FieldLabel",
113
+ "FieldDescription",
114
+ "FieldSeparator",
115
+ "FieldError",
116
+ "FieldTitle",
117
+ "HoverCard",
118
+ "HoverCardTrigger",
119
+ "HoverCardContent",
120
+ "InputGroup",
121
+ "InputGroupAddon",
122
+ "InputGroupButton",
123
+ "InputGroupText",
124
+ "InputGroupInput",
125
+ "InputGroupTextarea",
126
+ "InputOTP",
127
+ "InputOTPGroup",
128
+ "InputOTPSlot",
129
+ "InputOTPSeparator",
130
+ "Input",
131
+ "Item",
132
+ "ItemMedia",
133
+ "ItemContent",
134
+ "ItemActions",
135
+ "ItemGroup",
136
+ "ItemSeparator",
137
+ "ItemTitle",
138
+ "ItemDescription",
139
+ "ItemHeader",
140
+ "ItemFooter",
141
+ "Kbd",
142
+ "KbdGroup",
143
+ "Label",
144
+ "NativeSelect",
145
+ "NativeSelectOption",
146
+ "NativeSelectOptGroup",
147
+ "Pagination",
148
+ "PaginationContent",
149
+ "PaginationItem",
150
+ "PaginationLink",
151
+ "PaginationPrevious",
152
+ "PaginationNext",
153
+ "PaginationEllipsis",
154
+ "Popover",
155
+ "PopoverTrigger",
156
+ "PopoverContent",
157
+ "PopoverAnchor",
158
+ "Progress",
159
+ "RadioGroup",
160
+ "RadioGroupItem",
161
+ "ScrollArea",
162
+ "ScrollBar",
163
+ "Select",
164
+ "SelectTrigger",
165
+ "SelectValue",
166
+ "SelectContent",
167
+ "SelectGroup",
168
+ "SelectLabel",
169
+ "SelectItem",
170
+ "SelectSeparator",
171
+ "SelectScrollUpButton",
172
+ "SelectScrollDownButton",
173
+ "Separator",
174
+ "Sheet",
175
+ "SheetTrigger",
176
+ "SheetClose",
177
+ "SheetPortal",
178
+ "SheetOverlay",
179
+ "SheetContent",
180
+ "SheetHeader",
181
+ "SheetFooter",
182
+ "SheetTitle",
183
+ "SheetDescription",
184
+ "SidebarProvider",
185
+ "Sidebar",
186
+ "SidebarTrigger",
187
+ "SidebarRail",
188
+ "SidebarInset",
189
+ "SidebarInput",
190
+ "SidebarHeader",
191
+ "SidebarFooter",
192
+ "SidebarSeparator",
193
+ "SidebarContent",
194
+ "SidebarGroup",
195
+ "SidebarGroupLabel",
196
+ "SidebarGroupAction",
197
+ "SidebarGroupContent",
198
+ "SidebarMenu",
199
+ "SidebarMenuItem",
200
+ "SidebarMenuButton",
201
+ "SidebarMenuAction",
202
+ "SidebarMenuBadge",
203
+ "SidebarMenuSkeleton",
204
+ "SidebarMenuSub",
205
+ "SidebarMenuSubItem",
206
+ "SidebarMenuSubButton",
207
+ "Skeleton",
208
+ "Slider",
209
+ "Toaster",
210
+ "Spinner",
211
+ "Switch",
212
+ "Table",
213
+ "TableHeader",
214
+ "TableBody",
215
+ "TableFooter",
216
+ "TableRow",
217
+ "TableHead",
218
+ "TableCell",
219
+ "TableCaption",
220
+ "Tabs",
221
+ "TabsList",
222
+ "TabsTrigger",
223
+ "TabsContent",
224
+ "Textarea",
225
+ "ToggleGroup",
226
+ "ToggleGroupItem",
227
+ "Toggle",
228
+ "Tooltip",
229
+ "TooltipTrigger",
230
+ "TooltipContent"
231
+ ]);
232
+ function isShadcnComponent(tag) {
233
+ return SHADCN_COMPONENTS.has(tag);
234
+ }
235
+ const rule = {
236
+ meta: {
237
+ type: "problem",
238
+ docs: {
239
+ description: "require using `@class` instead of `class` on component invocations to ensure proper class merging",
240
+ category: "Best Practices",
241
+ url: "https://github.com/IgnaceMaes/shadcn-ember/blob/main/packages/cli/docs/rules/require-class-arg.md"
242
+ },
243
+ fixable: "code",
244
+ schema: [],
245
+ messages: { requireClassArg: ERROR_MESSAGE }
246
+ },
247
+ create(context) {
248
+ return { GlimmerElementNode(node) {
249
+ if (!isShadcnComponent(node.tag)) return;
250
+ for (const attr of node.attributes ?? []) if (attr.name === "class") context.report({
251
+ node: attr,
252
+ messageId: "requireClassArg",
253
+ data: { componentName: node.tag },
254
+ fix(fixer) {
255
+ const newText = context.sourceCode.getText(attr).replace(/^class/, "@class");
256
+ return fixer.replaceTextRange(attr.range, newText);
257
+ }
258
+ });
259
+ } };
260
+ }
261
+ };
262
+ var require_class_arg_default = rule;
263
+
264
+ //#endregion
265
+ //#region src/eslint/index.ts
266
+ const rules = { "require-class-arg": require_class_arg_default };
267
+ const plugin = { rules };
268
+ /**
269
+ * Flat config for enabling all shadcn-ember recommended rules.
270
+ * Requires `ember-eslint-parser` to be installed.
271
+ *
272
+ * @example
273
+ * ```js
274
+ * // eslint.config.mjs
275
+ * import shadcnEmber from 'shadcn-ember/eslint';
276
+ *
277
+ * export default [
278
+ * ...shadcnEmber.configs.recommended,
279
+ * // your other config...
280
+ * ];
281
+ * ```
282
+ */
283
+ const configs = { recommended: [{
284
+ plugins: { "shadcn-ember": plugin },
285
+ rules: { "shadcn-ember/require-class-arg": "error" }
286
+ }] };
287
+ var eslint_default = plugin;
288
+
289
+ //#endregion
290
+ export { configs, eslint_default as default, rules };
291
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["rule: Rule.RuleModule","requireClassArg","plugin: ESLint.Plugin","configs: Record<string, Linter.Config[]>"],"sources":["../../src/eslint/rules/require-class-arg.ts","../../src/eslint/index.ts"],"sourcesContent":["import type { Rule } from 'eslint'\n\nconst ERROR_MESSAGE =\n 'Pass `@class` instead of `class` to component `{{componentName}}`. Using `class` passes it as a splattribute and bypasses class merging via `cn()`/`cva()`.'\n\n/**\n * Known shadcn-ember component names that accept `@class`.\n */\nconst SHADCN_COMPONENTS = new Set([\n // accordion\n 'Accordion', 'AccordionItem', 'AccordionTrigger', 'AccordionContent',\n // alert-dialog\n 'AlertDialog', 'AlertDialogTrigger', 'AlertDialogPortal', 'AlertDialogOverlay', 'AlertDialogContent', 'AlertDialogHeader', 'AlertDialogFooter', 'AlertDialogTitle', 'AlertDialogDescription', 'AlertDialogAction', 'AlertDialogCancel',\n // alert\n 'Alert', 'AlertTitle', 'AlertDescription',\n // aspect-ratio\n 'AspectRatio',\n // avatar\n 'Avatar', 'AvatarImage', 'AvatarFallback',\n // badge\n 'Badge',\n // breadcrumb\n 'Breadcrumb', 'BreadcrumbList', 'BreadcrumbItem', 'BreadcrumbLink', 'BreadcrumbPage', 'BreadcrumbSeparator', 'BreadcrumbEllipsis',\n // button-group\n 'ButtonGroup', 'ButtonGroupText', 'ButtonGroupSeparator',\n // button\n 'Button',\n // card\n 'Card', 'CardHeader', 'CardTitle', 'CardDescription', 'CardAction', 'CardContent', 'CardFooter',\n // checkbox\n 'Checkbox',\n // collapsible\n 'Collapsible', 'CollapsibleTrigger', 'CollapsibleContent',\n // command\n 'Command', 'CommandDialog', 'CommandInput', 'CommandList', 'CommandEmpty', 'CommandGroup', 'CommandItem', 'CommandShortcut', 'CommandSeparator',\n // context-menu\n 'ContextMenu', 'ContextMenuTrigger', 'ContextMenuGroup', 'ContextMenuPortal', 'ContextMenuSub', 'ContextMenuRadioGroup', 'ContextMenuSubTrigger', 'ContextMenuSubContent', 'ContextMenuContent', 'ContextMenuItem', 'ContextMenuCheckboxItem', 'ContextMenuRadioItem', 'ContextMenuLabel', 'ContextMenuSeparator', 'ContextMenuShortcut',\n // dialog\n 'Dialog', 'DialogTrigger', 'DialogPortal', 'DialogOverlay', 'DialogContent', 'DialogHeader', 'DialogFooter', 'DialogTitle', 'DialogDescription', 'DialogClose',\n // dropdown-menu\n 'DropdownMenu', 'DropdownMenuTrigger', 'DropdownMenuGroup', 'DropdownMenuPortal', 'DropdownMenuSub', 'DropdownMenuRadioGroup', 'DropdownMenuSubTrigger', 'DropdownMenuSubContent', 'DropdownMenuContent', 'DropdownMenuItem', 'DropdownMenuCheckboxItem', 'DropdownMenuRadioItem', 'DropdownMenuLabel', 'DropdownMenuSeparator', 'DropdownMenuShortcut',\n // empty\n 'Empty', 'EmptyHeader', 'EmptyMedia', 'EmptyTitle', 'EmptyDescription', 'EmptyContent',\n // field\n 'FieldSet', 'FieldLegend', 'Field', 'FieldGroup', 'FieldContent', 'FieldLabel', 'FieldDescription', 'FieldSeparator', 'FieldError', 'FieldTitle',\n // hover-card\n 'HoverCard', 'HoverCardTrigger', 'HoverCardContent',\n // input-group\n 'InputGroup', 'InputGroupAddon', 'InputGroupButton', 'InputGroupText', 'InputGroupInput', 'InputGroupTextarea',\n // input-otp\n 'InputOTP', 'InputOTPGroup', 'InputOTPSlot', 'InputOTPSeparator',\n // input\n 'Input',\n // item\n 'Item', 'ItemMedia', 'ItemContent', 'ItemActions', 'ItemGroup', 'ItemSeparator', 'ItemTitle', 'ItemDescription', 'ItemHeader', 'ItemFooter',\n // kbd\n 'Kbd', 'KbdGroup',\n // label\n 'Label',\n // native-select\n 'NativeSelect', 'NativeSelectOption', 'NativeSelectOptGroup',\n // pagination\n 'Pagination', 'PaginationContent', 'PaginationItem', 'PaginationLink', 'PaginationPrevious', 'PaginationNext', 'PaginationEllipsis',\n // popover\n 'Popover', 'PopoverTrigger', 'PopoverContent', 'PopoverAnchor',\n // progress\n 'Progress',\n // radio-group\n 'RadioGroup', 'RadioGroupItem',\n // scroll-area\n 'ScrollArea', 'ScrollBar',\n // select\n 'Select', 'SelectTrigger', 'SelectValue', 'SelectContent', 'SelectGroup', 'SelectLabel', 'SelectItem', 'SelectSeparator', 'SelectScrollUpButton', 'SelectScrollDownButton',\n // separator\n 'Separator',\n // sheet\n 'Sheet', 'SheetTrigger', 'SheetClose', 'SheetPortal', 'SheetOverlay', 'SheetContent', 'SheetHeader', 'SheetFooter', 'SheetTitle', 'SheetDescription',\n // sidebar\n 'SidebarProvider', 'Sidebar', 'SidebarTrigger', 'SidebarRail', 'SidebarInset', 'SidebarInput', 'SidebarHeader', 'SidebarFooter', 'SidebarSeparator', 'SidebarContent', 'SidebarGroup', 'SidebarGroupLabel', 'SidebarGroupAction', 'SidebarGroupContent', 'SidebarMenu', 'SidebarMenuItem', 'SidebarMenuButton', 'SidebarMenuAction', 'SidebarMenuBadge', 'SidebarMenuSkeleton', 'SidebarMenuSub', 'SidebarMenuSubItem', 'SidebarMenuSubButton',\n // skeleton\n 'Skeleton',\n // slider\n 'Slider',\n // sonner\n 'Toaster',\n // spinner\n 'Spinner',\n // switch\n 'Switch',\n // table\n 'Table', 'TableHeader', 'TableBody', 'TableFooter', 'TableRow', 'TableHead', 'TableCell', 'TableCaption',\n // tabs\n 'Tabs', 'TabsList', 'TabsTrigger', 'TabsContent',\n // textarea\n 'Textarea',\n // toggle-group\n 'ToggleGroup', 'ToggleGroupItem',\n // toggle\n 'Toggle',\n // tooltip\n 'Tooltip', 'TooltipTrigger', 'TooltipContent',\n])\n\nfunction isShadcnComponent(tag: string): boolean {\n return SHADCN_COMPONENTS.has(tag)\n}\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'require using `@class` instead of `class` on component invocations to ensure proper class merging',\n category: 'Best Practices',\n url: 'https://github.com/IgnaceMaes/shadcn-ember/blob/main/packages/cli/docs/rules/require-class-arg.md',\n },\n fixable: 'code',\n schema: [],\n messages: {\n requireClassArg: ERROR_MESSAGE,\n },\n },\n\n create(context) {\n return {\n GlimmerElementNode(node: Rule.Node & { tag: string; attributes: Array<{ name: string; range: [number, number] }> }) {\n if (!isShadcnComponent(node.tag)) {\n return\n }\n\n for (const attr of node.attributes ?? []) {\n if (attr.name === 'class') {\n context.report({\n node: attr as unknown as Rule.Node,\n messageId: 'requireClassArg',\n data: { componentName: node.tag },\n fix(fixer) {\n // Replace 'class' with '@class' in the attribute name\n // The attribute range starts at the attribute name\n const sourceCode = context.sourceCode\n const attrText = sourceCode.getText(attr as unknown as Rule.Node)\n const newText = attrText.replace(/^class/, '@class')\n return fixer.replaceTextRange(attr.range, newText)\n },\n })\n }\n }\n },\n }\n },\n}\n\nexport default rule\n","import type { ESLint, Linter } from 'eslint'\n\nimport requireClassArg from './rules/require-class-arg'\n\nconst rules = {\n 'require-class-arg': requireClassArg,\n}\n\nconst plugin: ESLint.Plugin = {\n rules,\n}\n\n/**\n * Flat config for enabling all shadcn-ember recommended rules.\n * Requires `ember-eslint-parser` to be installed.\n *\n * @example\n * ```js\n * // eslint.config.mjs\n * import shadcnEmber from 'shadcn-ember/eslint';\n *\n * export default [\n * ...shadcnEmber.configs.recommended,\n * // your other config...\n * ];\n * ```\n */\nconst configs: Record<string, Linter.Config[]> = {\n recommended: [\n {\n plugins: {\n 'shadcn-ember': plugin,\n },\n rules: {\n 'shadcn-ember/require-class-arg': 'error',\n },\n },\n ],\n}\n\nexport default plugin\nexport { configs, rules }\n"],"mappings":";AAEA,MAAM,gBACJ;;;;AAKF,MAAM,oBAAoB,IAAI,IA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